-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6u16
-
x86
-
linux_2.6
When a JComboBox has some ItemListeners registered, it should notify them whenever an item is selected or deselected. But the current implementation does not notify the listeners if a different item is selected as a result of changing the JComboBox's model.
This bug is 100% reproducible both with JDK 1.5.0_21 and with JDK 6u16.
I have created a simple application that does this:
1) Creates a combo box model containing items: "Monday", "Tuesday", "Wednesday"
2) Creates a second combo box model containing items "Alpha", "Beta", "Gamma"
3) Creates a combo-box with the first model passed as the initial model.
4) Selects item "Tuesday".
5) Selects item "Wednesday".
6) Switches the combo-box's model to the second model ("Alpha", "Beta", "Gamma").
7) Selects item "Beta".
8) Selects item "Gamma".
The application also writes a short note to the standard output whenever the listener's ItemListener is notified about the selection change.
(See the attachment for the source code of the simple application.)
Expected behaviour:
When the second model is assigned to the combo-box, the combo-box should notify all registered listeners about change of selected item.
Actual behaiour:
The listeners are not notified.
This bug is 100% reproducible both with JDK 1.5.0_21 and with JDK 6u16.
I have created a simple application that does this:
1) Creates a combo box model containing items: "Monday", "Tuesday", "Wednesday"
2) Creates a second combo box model containing items "Alpha", "Beta", "Gamma"
3) Creates a combo-box with the first model passed as the initial model.
4) Selects item "Tuesday".
5) Selects item "Wednesday".
6) Switches the combo-box's model to the second model ("Alpha", "Beta", "Gamma").
7) Selects item "Beta".
8) Selects item "Gamma".
The application also writes a short note to the standard output whenever the listener's ItemListener is notified about the selection change.
(See the attachment for the source code of the simple application.)
Expected behaviour:
When the second model is assigned to the combo-box, the combo-box should notify all registered listeners about change of selected item.
Actual behaiour:
The listeners are not notified.