ComboBox is a GWT widget that has rather similar functionality with standard ListBox. The main differences are:
Taking into account features and restrictions listed above you can make decision whether you need this component.
It's very easy. Consider the sample below.
//create and fill combo box model ComboBoxDataModel model = new ComboBoxDataModel(); for (int i =0; i <10; i++) model.add(String.valueOf(i),"Option " + i); ComboBox comboBox =new ComboBox();//create comboBox.setModel(model);//apply the model
Note that you should set the combo box data model before you display it. Otherwise it won't work properly. On the other hand you can dynamically set a new instance of the model and invoke the display() method again and again.
Yes, it's possible. Just use the org.gwt.advanced.client.ui.widget.cell.ComboBoxCell when you create a new instance of the grid. Some details about it can also find in this topic.
Yes, keyboard events handling is supported since the 1.4.8 version. The following table contains shortcuts and descriptions for each action you can do with a keyboard.
Shortcut | Description |
---|---|
Enter | Opens a drop-down list if it's closed, otherwise chooses a currently highlight item in the list |
Esc | Closes opened drop-down list without choosing an item |
Arrow Up | Moves the list cursor up |
Arrow Down | Moves the list cursor down |
Tab | Moves focus to the next focusable element on the screen |
Shift-Tab | Moves focus to the previous focusable element on the screen |