Sub-window sizing issue!

Hi,

I’m having trouble with adapting the initial horizontal size of a sub-window. The sub-window is defined as follows:

public class ProjectDialog extends Window {

    private final ProjectPanel pp;
    
    public ProjectDialog() {
        super("Project Dialog"); // Set window caption
        center();
       
        pp = new ProjectPanel();
        VerticalLayout content = new VerticalLayout();
        setContent(content);
        content.setWidth("100%");
        content.addComponent(pp);
        setModal(true);
       
        setClosable(false);
       
        Button ok = new Button("OK");
        ok.addClickListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                close(); // Close the sub-window
            }
        });
        content.addComponent(ok);
    }
}

ProjectPanel component is a custom made component!

When the sub-window pops-up is refuses to adapt to the horizontal size of the ProjectPanel component!

How can I solve this issue! I’ve been fiddling with setWidth but am afraid I don’t proparly understand the sizing fundamentals of Vaadin!

Any help related to this issue would be very much appreciated! Thanks in advance!

Regards,
Gerard

for the window to follow the sizing of any child, it needs to be undefined width (undefined layouting == child decides). This also applies to the layout you have as content. So, calling

setWidth(null);
content.setWidth(null);

should do the trick.

Thanks and it indeed does the trick! Great!

Regards,
Gerard