Maneesh Godbole wrote:ItemListener is triggered when the item selection changes. Check out the API for any method which will let you programatically change the selection. Check if this fires the event.
the itemStateChanged event is never called upon, when the setSelectedIndex(0) is set after it
I agree if you invoke setSelectedIndex() on the JComboBox it does not fire the event - it's quite easy to see just do a print from the itemStateChanged() method in the ItemListener or set a debug point in there.
I'd find this useful as I have an underlying data structure which I update when the combobox item is selected - but it needs initialising.
Obviously, I can do that by hand but it would be better/more consistent to do it via the event handler