In this basic case, you can do the following:
ComboBox cb = new ComboBox(); cb.addItem("FED"); cb.setItemCaption("FED", "Federation"); cb.addItem("INV"); cb.setItemCaption("INV", "Innovation"); main.addComponent(cb);
But I really recommend that you become familiar with objects and properties in Vaadin. Each choice in ComboBox (and many other components in Vaadin) is an element that can have any number of properties. You can show any of these properties as the title of an element in a ComboBox.
See the book for more details.
source share