Smart gwt window position
How do I make a window popup in a specific location on the page? I don't s开发者_高级运维ee a straightforward way of doing this, so I'm always using window.centerInPage()
Using the underlying setRect() method of Canvas: Canvas.setRect(int left, int top, int width, int height)
window.setRect(250, 100, 500 500);
Remember to redraw as needed.
Or, if you're using the GWT Window, you can achieve that by using the Window.open(String url, String target, String features) method, as specified here.
Window.open(URL, "newWindow", "left=250,top=100,width=500,height=500");
not sure if this is the best way, but works:
int browserInnerWidth = com.google.gwt.user.client.Window.getClientWidth();
myWindow.show();
myWindow.setLeft(browserInnerWidth - windowWidth);
精彩评论