Skip to content

Creating a new window on button click – Vaadin14

I want to create a new Window using:

final Window window = new Window("Window");

This is from the Vaadin homepage

But unfortunately my IDE is showing the following error: The constructor Window(String) is undefined.

When i delete the string, it says: the constructor Window() is not visible.

Why is that? In the vaadin demo it works just fine.


There is no Window class in Vaadin 14.

The demo page you linked in the question is about Vaadin 8.

In Vaadin Flow (Vaadin 10+), the Dialog is used instead of the old Window. It’s not exactly the same as the old Window – for example the Dialog has no maximize or close button automatically. But along with other components you want to show within that Dialog, you can add for example a button that will close the dialog when clicked. Or let the dialog close when the user clicks outside it using dialog.closeOnOutsideClick(true);

Edit: go check out this vaadin blog post of a good looking Dialog example, with video (and code is also linked there):