I would like to add an ActionListener
to a group of buttons.
Is there any class that wrap the buttons? Something like GroupJButtons
or something more generally group of objects? so I can set an ActionListener
to all of them.
After all I don't really care which buttons is pressed I just want to change his text so all I need to do is casting it to a JButton
and changing the text.
The whole process would reduce the code lines in 1 or 2 (in case you use a loop) but I want to do that since it sounds logically better.