Create a SubWindow in a View

I use vaadin 8.
I have the following class, in which i want to create a SubWindow:

public class TitleView extends VerticalLayout implements View {
	private Button details;

	public TitleView(TitleService service) {
		Button details = new Button("details");
		details.addClickListener(event -> showDetails());

		HorizontalLayout tb = new HorizontalLayout(details);

	private void showDetails() {
        // Create a sub-window and set the content
        Window subWindow = new Window("Sub-window");
        VerticalLayout subContent = new VerticalLayout();

        // Put some components in it
        subContent.addComponent(new Label("Meatball sub"));
        subContent.addComponent(new Button("Awlright"));

        // Center it in the browser window;

        // Open it in the UI, but not work
		=> Error !!!!!!!!!!!!!!!!!!!!!!!

How can i add the Window to the View?

In Vaadin you cannot add Window into view. Windows are always added via UI. In your case this means that you need to change
addWindow(subWindow); → getUI().addWindow(subWindow);

Now it works

Hi, any idea on how it needs to be done in Vaadin 14. Tried this getUI().get().add(windowScreen);
But this doesn’t work.