Selecting multiple items from combobox


Pls i want to know how to change the selectionmodel of javafxml combobox so that it can allow multiple seletion. Any contribution will be appreciated thanks.

10/3/2014 8:45:28 PM

You could try an ControlsFX CheckComboBox (ControlsFX is a 3rd party controls library for JavaFX).


Just copied from the CheckComboBox javadoc:

A simple UI control that makes it possible to select zero or more items within a ComboBox-like control. Each row item shows a CheckBox, and the state of each row can be queried via the check model.

 // create the data to show in the CheckComboBox 
 final ObservableList<String> strings = FXCollections.observableArrayList();
 for (int i = 0; i <= 100; i++) {
     strings.add("Item " + i);

 // Create the CheckComboBox with the data 
 final CheckComboBox<String> checkComboBox = new CheckComboBox<String>(strings);

 // and listen to the relevant events (e.g. when the selected indices or 
 // selected items change).
 checkComboBox.getCheckModel().getSelectedItems().addListener(new ListChangeListener<String>() {
     public void onChanged(ListChangeListener.Change<? extends String> c) {

Note: the JavaFX controls developer lead comments on the in-built combobox control for JavaFX:

you can put whatever selection model instance you want into ComboBox, but only single selection will ever be supported. We did this as multiple selection didn't really make sense without drastic changes to the UI and UX, and we figured a separate control could be developed in the future to better support this use case

The CheckComboBox control from ControlsFX is that seperate control.

10/3/2014 11:04:43 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow