Control size of a panel with components in them


I have a weird issue. I have a panel with a vertical layout in it. The panel has a width of 100% and a height of 600 pixels. I have two components in this panel (backed by a VerticalLayout). The first is the main area and should take all the available space. The second is a footer with a height of 30 pixels and a width of 100%

When I build initially my panel all is fine. I use setExpandRation(mainComponent, 1f) to make sure it takes all the available space.

I tried to refactor that a bit in component. The problem is that if I call setWidth or setHeight on my panel, it seems the expand ratio is lost (the new size is ok but the main component takes half of the space and the footer is at the middle of the screen with a lot of empty spaces.

Also, the only way I found to control the size of the panel was to create the layout outside of the panel, set the size of the layout and set the layout to the panel afterwards.

What am I missing?


The panel and the layout inside are separated elements.
You can change the size of the panel with panel.setWidth(…) and the size of it’s layout with panel.getContent().setWidth(…)

right, setting the panel with setSizeFull() was enough to make sure that the content is resized according to the size of the panel.