We're currently developing an applet for editing web pages, and we've come across a problem.
The user has previously chosen a colour scheme and as such has an arbitrary number of colours they can select for text. We create the interface for the pallette with buttons, which are created via a loop. However, the event listener does not accept the button as a valid object from which to display the value.
Basically, how do we create an unfixed number of buttons with listeners thereon?
If I understand it correctly,what you can do is create a generic class that has psecific(custome) methods for your possible events and then when you create any button you can do something like this
JButton xButton = new JButton();
xButton.addActionListener(new CustomEventClass());
Bookmarks