设置对应于window-size的popup-window-size

时间:2011-01-04 10:58:04

标签: gwt gwt-ext

我有一个gwt-ext窗口(用作弹出窗口),这个弹出窗口是从GWT应用程序启动的。我正在寻找一个解决方案,将弹出窗口的窗口大小设置为一个大小,它几乎填满屏幕,而不是最大化,但填充启动此弹出窗口的GWT应用程序的底层部分的区域。有人知道这个问题的解决方案吗?

2 个答案:

答案 0 :(得分:3)

尝试这样的事情:

int windowHeight=Window.getClientHeight()-10; //I subtract 10 from the client height so the window isn't maximized.
int windowWidth=Window.getClientWidth()-10; //I subtract 10 from the client width so the window isn't maximized.
yourExtGwtWindow.setHeight(windowHeight);
yourExtGwtWindow.setWidth(windowWidth);

答案 1 :(得分:1)

这将根据屏幕尺寸(不是当前的浏览器尺寸)进行调整

yourExtGwtWindow.setHeight(screenHeight());
yourExtGwtWindow.setWidth(screenWidth());

...

public static native int screenWidth() 
/*-{ 
      return screen.availWidth; 
}-*/; 

public static native int screenHeight() 
/*-{ 
      return screen.availHeight;
}-*/;