Search code examples
gwtbrowsermenubar

Open gwt submenu direction depending on window boundaries


I am creating a vertical gwt menubar and I am wonder if there is a way to detect the browser window boundary. I want to open a sub menu on the right (as its natural) if it doesn't cause it to go wider than the bounds of the browser window, otherwise I want to open to the left. Is there a way to programmatically know the bounds of the browser window to achieve this functionality.


Solution

  • You can use Window.getClientWidth() and Window.getClientHeight() to get the window boundaries.