Search code examples
windowsmartgwt

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


Solution

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