I created an array of JButtons
with anonymous ActionListeners
and under certain conditions I want to remove all the ActionListeners
, b
You can't. Nobody has a reference to those objects. In order to be able to remove them you'll need to store it as a data member/variable in your code and then pass that variable to the removeActionListener()
method. However, what you could do is use the getActionListeners()
method to get an array of all of the ActionListener
objects associated with the Button
. You'll then need to figure out which one to remove, but if there's only one, that should be easy ;-)