Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Aligning components in a form
Hi,
I have a formlayout and i want to align three components for data entry (these are for specifying recurring meetins, such a repeats EVERY 1 WEEK for 3 MONTHS. They should be horizontally aligned, but as you will see form attached screen shot, they aren't.
I have tried with a horizontal layout for just these fields and also a grid layout:-
GridLayout repeatsLayout = new GridLayout(4, 1);
Any suggestions?
First of all, there is no need for the GridLayout, if it's just one row. Just use HorizontalLayout to make the components render horizontally next to each other.
Your screenshot doesn't quite tell why the components are not aligned in the same way. They are all of the same hieght, so they should be aligned in the same way. Seems like you are leaving out some detail.
Regardless, to align a component, use the setComponent alignment method, which is available in all the three layouts you've mentioned (GridLayout, FormLayout, HorizontalLayout).
yourLayout.setComponentAlignment(componentYouWantToAlign, Alignment.BOTTOM_LEFT);
Hi, Same issue whatever i try - i cannot align center, only bottom (in fact, i cant even put some spacing between these components)? See attached.