The problem with the layout

I welcome!

In my case it looks like this -


...
public class MainWindow extends Window {
...
[color=#f61313]
setSizeFull();
[/color]
...
VerticalLayout mainLayout = new VerticalLayout();        
[color=#f61313]
mainLayout.setSizeFull();
[/color]
...

Panel centerPanel = new Panel();
[color=#f61313]
centerPanel.setSizeFull();
[/color]

....

mainLayout.addComponent(centerPanel);
mainLayout.setComponentAlignment(centerPanel, Alignment.TOP_CENTER);
...

centerPanel.addComponent(workPanel);
...

workPanel in my case:


...
public Panel buildPanel() {
Panel panel = new Panel();		
panel.setStyleName("v-panel-instrumental");
[color=#f61313]
panel.setSizeFull();
[/color]
		
HorizontalLayout hl = new HorizontalLayout();
hl.setWidth("100%");
hl.setSpacing(true);
hl.setMargin(true);
hl.setStyleName(Reindeer.LAYOUT_BLUE);

VerticalLayout vl = new VerticalLayout();
vl.setSpacing(false);
vl.setMargin(false);
vl.setStyleName(Reindeer.LAYOUT_BLUE);
		
AdminUsers adminUsers = new AdminUsers();
Label lh2 = new Label("Администрирование");
lh2.setStyleName(Reindeer.LABEL_H2);
		
Label lsmall = new Label("Панель режима администратора");
lsmall.setStyleName(Reindeer.LABEL_SMALL);
		
vl.addComponent(lh2);
vl.addComponent(lsmall);
		
hl.addComponent(vl);
		
panel.addComponent(hl);
panel.addComponent(adminUsers);
		
return panel;

...

…but… → :glare:
12193.png

Hi,

I guess the missing step in your quest - is to set the size of the centerPanel’s content (a Panel is nothing but a ComponentContainer for ONE component which is ComponentContainer itself, by default it is a VerticalLayout). Calling the following:

centerPanel.getContent().setSizeFull()

Should do the trick.

cheers,
sasha

I welcome you, Alexander V Pchelintsev!

…Whew! Yes, it helped, thanks a lot! :smiley: