How to populare a Combobox

Hi all,

I need to populate a ComboBox with some Items.
An Item has an ID and a VALUE.
What’s the right way to populate a ComboBox…I am just a bit confused.
Cheers.

              Stefano

Hey Stefano,

Did you take a look at
https://vaadin.com/book/-/page/components.selecting.html
? For the most basic use, adding items can be done with
addItem
:

ComboBox cb = new ComboBox("Something");

for(int i = 0; i < 100; i++) {
  cb.addItem("Item #" + i);
}

Also, if you want the caption to be different from the item ID, you can use
setItemCaption
.