Reputation: 105
Code below demonstrates this issue:
@Component
@UIScope
public class TestForm extends CustomComponent {
public TestForm() {
HorizontalLayout hlayout = new HorizontalLayout();
VerticalLayout vlayout = new VerticalLayout();
hlayout.setSizeFull();
vlayout.setStyleName("page");
Label label1 = new Label("Label1");
Label label2 = new Label("Label2");
hlayout.addComponent(label1);
vlayout.addComponent(label2);
hlayout.addComponent(vlayout);
setCompositionRoot(hlayout);
}
}
Result: enter image description here
Thank you!
Upvotes: 2
Views: 841
Reputation: 37008
Since Vaadin 8, the default for VerticalLayout
is to have a "margin". That means you get the padding you are experiencing per cell of the layout. So put the label2
in the place you want it to be, you have call to:
vlayout.setMargin(false)
Upvotes: 2