Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
WebBrowser.getScreenHeight() / getScreenWidth() both return 0
I attempting to get the Browser Screen Width / Height using com.vaadin.terminal.gwt.server.WebBrowser class. I've used the same code as posted in the online Vaadin Sampler application to instatiate a WebBroswer object. I.E
WebApplicationContext context = ((WebApplicationContext) getApplication().getContext());
WebBrowser wb = context.getBrowser();
System.out.println(wb.getScreenHeight());
System.out.println(wb.getScreenWidth());
Output is 0 for both. I'm using Goolge Chrome 16.0 as my main browser but get same result with IE 9 and Firefox 9
Output on the Sampler is correct at 1920 x 1080
I'm using Vaadin 6.7.4 (same result with 6.7.2) with Navigator7 7.49
Does anyone have any suggestions?
When are you calling that function ?
I think it may not be fully initialized yet during Application.init() so 0 might happen.
Have you tried at another moment (like from a click listener) to check ?
Yup...that was the issue.
Many Thanks!
Mathias Clerc: When are you calling that function ?
I think it may not be fully initialized yet during Application.init() so 0 might happen.
Have you tried at another moment (like from a click listener) to check ?