How to aligned Vertical List of 2 Labels in a Grid

Hi all,

I am new to Vaadin and this is my first post.

I am using Grid component to display data and I need to display 2 values in a single cell.
To do that, I use a custom cell renderer based on a Vertical layout containing 2 Labels as below:

		Label label1 = UIUtils.createAmountLabel(d1);
		Label label2 = UIUtils.createAmountLabel(d2);
		
		FlexBoxLayout listItems = new FlexBoxLayout(label1, label2);
		listItems.setFlexDirection(FlexDirection.COLUMN);

My problem is that Label1 and Label2 have a default Left alignment.
In my case the values I need to display are Numeric and I would like to have a Right alignment.

I don’t know how to specify a right alignment programmatically (only when the values are Numeric).
Any help would be greatly appreciated.

Thanks & regards,
Guillaume

Hi Guillaume,

You can do gridColumn.setTextAlign(ColumnTextAlign.END). If that doesn’t work you can try listItems.setAlignItems(FLEX_END).

Hi Joacim,
thanks for your reply. If have used the second option and it works fine listItems.setAlignItems(Alignment.END)
Have nice day
Regards,
Guillaume