ActionListener on JComboBox fires subsequently on next all Comboxes
Joined: Oct 15, 2008
I am facing a problem with JComboBoxActionListener. I have 3 comboBox and the logic which I am expecting is -
User select Item from 1st combobox, then only 2nd comboBox will be populated.
then user selects 2nd combobox, then 3rd comboBox will gets populated.
and so on.
I have made only 3 combobox here for this post. in an actual scenario I have around 8-10 combobox'x each having nearly 10 items.
The problem I am facing here is very tedious. All the listeners in all combobox's fired.
I tried removing and then re-adding action listener, but that gives me compilation issue.
1st issue - Cannot refer to a non-final variable listener inside an inner class defined in a different method
to correct this, if I make ActionListener definition as final, then another compilation issue comes - The local variable listener may not have been initialized.