ListSelect
The ListSelect component is list box that shows the selectable items in a vertical list. If the number of items exceeds the height of the component, a scrollbar is shown. The component allows selecting multiple values.
// Create the selection component
ListSelect<String> select = new ListSelect<>("The List");
// Add some items
select.setItems("Mercury", "Venus", "Earth", ...);
// Show 5 items and a scrollbar if there are more
select.setRows(5);
select.addValueChangeListener(event -> {
Set<String> selected = event.getNewSelection();
Notification.show(selected.size() + " items.");
});
The number of visible items is set with setRows().
The ListSelect Component
Common selection component features are described in "Selection Components".