Kwame
Kwame

Reputation: 1097

Smart gwt window position

How do I make a window popup in a specific location on the page? I don't see a straightforward way of doing this, so I'm always using window.centerInPage()

Upvotes: 1

Views: 3152

Answers (2)

Pat
Pat

Reputation: 11

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);

Upvotes: 1

Kimi
Kimi

Reputation: 6289

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");

Upvotes: 1

Related Questions