Is it possible to make a ListBox containing another component as its items?

Hi,

I need to create a ListBox in which I want to list a series of pre-defined HorizontalLayouts.
Is it even possible to do?
Because I have created my ListBox object like this (defining and setting the items with HorizontalLayout type), but in practice the items are being converted to String (refer to attachment).

List<HorizontalLayout> items = new ArrayList<>();
ListBox<HorizontalLayout> listBox = new ListBox<>();
for (int i=1; i <= 10; i++) {
	// getItem() returns a HorizontalLayout
	items.add(getItem());
}
listBox.setItems(items);

18167294.png

Hi.

I guess you can use

listBox.setRenderer(...)

to customize the ListBox view.

If that’s not working you could try to switch to a grid.