Hi,
Am trying to create a simple page where in heading should appear on the top center.
Here is the code -
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSizeFull();
setContent(layout);
Label headingLabel = new Label(“Hello World!”);
headingLabel.setStyleName(“h1”);
layout.addComponent(headingLabel);
layout.setComponentAlignment(headingLabel, Alignment.TOP_CENTER);
But the heading appears top-left. Alignment’s posing a big problem. Please help.
Kurki
(Teppo Kurki)
2
Hi,
Label components are 100% wide by default. Try calling headingLabel.setSizeUndefined().
ashes
(ashes ashes)
3
layout.setWidth("100%");
headingLabel.setWidth(null);
Hello ashes,
Tried the following -
layout.setWidth(“100%”);
headingLabel.setWidth(null);
that doesn’t look to be fixing the problem.
Larsen.