Docs

Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Browser Window Resize Events

The Page class allows you to register a listener for events that affect the web page and the browser window in which the Vaadin UI resides. The Page instance corresponding to a given UI is accessed by the getPage() method of the UI.

Example: Accessing the browser window size and adding a size-change listener.

Page page = UI.getCurrent().getPage();
page.addBrowserWindowResizeListener(
        event -> Notification.show("Window width="
                + event.getWidth()
                + ", height=" + event.getHeight()));

1DC50FA7-65E7-4319-982C-BE5F6120E791