center window only horizontally

Hi All

I have this window which I used to center like


public class View extends Window {

public View() {



[/code]Works great. However, now I would like to set the
(vertical) position of this window, and keep it centered horizontally. If I add, for example,


the horizontal position is lost.

Any suggestions how to do this ?


I guess there center-mode is somehow handled differently in Window, but for me this sound like a bug. Setting Y position should not affect the X position at all.

If you cannot find a solution I suggest to file a bug at

had the same issue with a difference in that the width of my sub windows was fixed (to 700px)

Thanks to Henri kerola here is how it was solved:

In window there is a getBrowserWindowWidth() which helps in this situation since then you can do something like :

int browserWindowWidth = mainWindow.getBrowserWindowWidth();
subWindow.setPositionX((browserWindowWidth - 700) / 2);

hope this may help.