Best practice for Window sizing (content invisible due to high height)

Hello!

I’m working on an application with a lot of Window (com.vaadin.ui.Window).
The content of each Window is not predictable and the height could be high or low depending the case.

But I don’t understand the mechanism behind to add a vertical scrollbar when the content inside the Window is too high for the resolution of the screen.

My Window have 1200px for width and undefined height.
At th beginning, I do this in the Window constructor:

        this.setModal(true);
        this.setResizable(false);
        this.setWidth(1200, Unit.PIXELS);
        HorizontalLayout buttonsLayout = new HorizontalLayout(btnSave, btnClose);
        buttonsLayout.setSpacing(true);
        // getMainLayout() is a VerticalLayout.
        this.setContent(getMainLayout());
        getMainLayout().setMargin(true);

But when the elements inside getMainLayout() take too much vertical space, the content is not visible.
So I have done this (add a Panel):

        this.setModal(true);
        this.setResizable(false);
        this.setWidth(1200, Unit.PIXELS);
        HorizontalLayout buttonsLayout = new HorizontalLayout(btnSave, btnClose);
        buttonsLayout.setSpacing(true);
        // getMainLayout() is a VerticalLayout.
        this.setContent(new Panel(getMainLayout()));
        getMainLayout().setMargin(true);

Without better result… So why the vertical scrollbar isn’t there?

Thank you for your replies.