I'm binding a JComboBox
to an observable List
. I clear and add Objects
form the observable list. This works fine and reflects the changes in the JComboBox
correctly.
The problem is I can't select the content of the list using the mouse although the newly added items are correctly displayed in the combobox when expanded. The getSelectedItem()
is always stuck on the first item in the list.
List<Object> sourceListObserver =
ObservableCollections.observableList(new ArrayList<Object>());
The binding is done using Netbeans GUI designer.
I have now also tried using DefaultComboBoxModel
.
DefaultComboBoxModel model = new DefaultComboBoxModel();
wireSourceComboBox.setModel(model);
Using wireSourceComboBox.removeAllItems();
and wireSourceComboBox.addItem(qb);
Still the same behaviour after removing and adding objects to the combobox.