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?