posted 19 years ago
I am using a JComboBox as an editor in a JTable, and am having a problem with the ItemListener. I have the combo set up so that the user has to double click on the cell before the combo will open (using setClickCountToStart method on DefaultCellEditor).
According to the swing tutorial, a JComboBox will fire two itemStateChanged events when a new item is selected in a combo and it will not fire any itemStateChanged events if the same item is selected.
In my combo, when you double click, the combo opens showing the drop down list, when you click again (without moving the mouse) it closes. The selection in the combo is the same as it was before you double clicked. But still the itemStateChanged event is being fired!!!
Can anyone tell me why this happens and/or how to fix it? I only want to do something when the selection actually changes....
Here is a code extract:
Thanks in advance!
Alex