Aligning components in a form


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
the components are not aligned in the same way. They are all of the same hieght, so they
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.