more than one layout in one page

Hello,

I have created a page based on the panel from vaadin demo, but with more than one layouts to show/hide some components for different situation, how can i set every component aligned correctly? in the small and large panel?
Thanks.

public class EditUserForm extends VerticalLayout
{
    private FormLayout userNameLayout = new FormLayout();
    private FormLayout passwordLayout = new FormLayout();
    private FormLayout criteriaLayout = new FormLayout();

        userNameLayout.addComponents(username, displayName);
        passwordLayout.addComponents(password1, password2);
//        newUserPanel.setContent(newUserLayout);
        userNameLayout.setSizeUndefined();
        passwordLayout.setSizeUndefined();
        addComponent(userNameLayout);
        addComponent(passwordLayout);

}

void create()
{
        passwordLayout.setVisible(true);
        criteriaLayout.setVisible(false);
        username.setReadOnly(false);
        setVisible(true);
        
}

21024.png
21025.png

Hi!

No built-in way for this, I’m afraid. You can either use one layout (e.g. with separate fieldgroups) or you need to set some fixed widths in your theme or via CustomLayout htmls.