Performing the same action on many JButtons at once
Posted on 2004-10-01
Within an Applet, Image I have a JPanel, called NavPanel which contains a number of buttons, which are used to navigate around the Applet.
When the user wants to switch screens the NavPanel is cleared and a new set of JButtons are then put in situ.
The problem I have is that I have to remove the Action Listener for each button.
I am doing this per object e.g.
There must be a better way!
How can I set the method up so that it does something like this:
For Each Object in NavPanel
Bearing in mind the number of objects will vary
Anyone care to have a stab at this one?