Scrollable OptionGroup

I have a window for which I set as content a FromLayout. In this layout, I put a TextField, an OptionsGroup and a Button.

The problem is that the scrolling is assigned to the whole FromLayout, and the desired behaviour is that only the OptionGroup should be scrollable.

The result is that the Button in the end of the FrameLayout is not visible unless the user scrolls all the way down. I want the Button to be visible on the bottom of the Window all the time and the OptionGroup list to be scrolling behind it.

Here is the code:

        Window window = new Window(caption);
        window.setModal(true);
        window.center();
        window.setWidth(null);
        window.setHeight(Math.round(0.5 * Page.getCurrent().getBrowserWindowHeight()), Unit.PIXELS);

        FormLayout formLayout = new FormLayout();
        formLayout.setMargin(true);
        formLayout.setWidth(null);

        window.setContent(formLayout);

        BeanFieldGroup<Role> fieldGroup = new BeanFieldGroup<>(Role.class);

        TextField roleNameField = new TextField("Name");
        
        formLayout.addComponent(roleNameField);
        
        OptionGroup permissionsSelect = new OptionGroup();
        permissionsSelect.setMultiSelect(true);
        permissionsSelect.setImmediate(true);
        
        formLayout.addComponent(permissionsSelect);

        Button submitButton = new Button("Submit");

        formLayout.addComponent(submitButton);

        getUI().addWindow(window);

I removed unnecessary line of code.

I hope I am understood.

Put your option group inside of a panel with a fixed height:

Panel optionsWindow = new Panel("No caption");
optionsWindow.setHeight("200px");

OptionGroup permissionsSelect = new OptionGroup();
permissionsSelect.setMultiSelect(true);
permissionsSelect.setImmediate(true);
permissionsSelect.addItem("One");
permissionsSelect.addItem("Two");
permissionsSelect.addItem("Three");
permissionsSelect.addItem("4");
permissionsSelect.addItem("5");
permissionsSelect.addItem("6");
permissionsSelect.addItem("7");
permissionsSelect.addItem("8");
permissionsSelect.addItem("9");
permissionsSelect.addItem("10");
permissionsSelect.addItem("11");

optionsWindow.setContent(permissionsSelect);
formLayout.addComponent(optionsWindow);

Curtis

Thanks for the reply but I managed it after all through CSS by adding the following rule

.v-select-optiongroup { overflow-y: scroll; }