I'm writing a gui program and have an AbstractAction for a Jbutton that opens a file. In a JComboBox I have a list of the files that have been opened. The AbstractAction for the JComboBox will change back to any of the files that have been opened. When I update the list for a JComboBox though the action fires.

So when I actually open a file the JComboBox action fires, and when I use the JComboBox the action fires once, then a second time when updating.

Is there a way i can stop the event when just updating the JComboBox list?

You can remove the listener and then re-add it. Or you could have it's actions controlled by a boolean field.
–
Hovercraft Full Of EelsJan 19 '12 at 5:06

Is removing, re-adding, more efficient than just letting the event be called, and having a check inside the AbstractAction actionPerformed method? Currently I just check if the new file's name is equal to updated, and if it is I skip most of what happens in the event.
–
Dustin JensenJan 19 '12 at 6:10