Re: Remove all listeners?
I found a simple walkaround for the ones in need. Just make one huge listener with a conditional/switch statement (each branch of the if statement would contain a different action listener code), and activate each part of the listener by activating the representing if statement.
THIS is not efficient in all the situations though, so if there is any better way, please post it:)
Re: Remove all listeners?
Quote:
Now i know there is no removeAllListeners() method but i thought there is some way of detecting the names of Anonymous ( is that how are they called?) Listeners, so i can remove them with removeActionListener();?
What names?
Save the listener to a variable and then use that to remove the listener ie
Code:
ActionListener myListener = new ActionListener () { ... }
s_UpdateButtonView.addActionListener(myListener);
...
s_UpdateButtonView.removeActionListener(myListener);
If you have lots of them then consider using a Map to store the listeners and assigning your own names as the keys.
Re: Remove all listeners?
oh my... I feel so stupid now :-S... Before this I only knew how to do this by extending ActionListener, which ate a lot of time.. Thanks