How to get a JButton in Collection to Modify another JButton
Posted on 2005-04-14
I've created a collection of extended JButtons in a JPanel.
Upon clicking a button, the button performs an action, however, I also need it to modify preference on a few adjacent buttons namely the iconfield.
The restriction I have is that the extended button is not directly aware of adjacent buttons because it may or many not have them. The JPanel does however does know about the buttons because of the collection.
I've tried to add a Listener on the JPanel but it only gets triggered during an add or removal of a button.
I've tried to use a MouseListener on the JPanel but I'm not getting the index of the button that performed the click.
Does anyone have any suggestions on how to perform this action?