java detect clicked buttons

Posted by user253530 on Stack Overflow See other posts from Stack Overflow or by user253530
Published on 2010-05-25T03:05:03Z Indexed on 2010/05/25 3:11 UTC
Read the original article Hit count: 231

Filed under:

I have multiple panels on a JFrame window. I am going to populate each panel differently every time. For example: i start the GUI: (image center panel, right panel, bottom panel). Center panel is populated with 20 buttons, right panel with 10 buttons and bottom panel with 3.

second start of the GUI (same gui). Center panel has 50 buttons, right panel has 12 buttons, bottom has 3.

So everytime there is a random number of buttons, impossible to be all uniquely named. Given the fact that I don't have a unique name for each button (just a list) I would like to know which buttons were clicked according to the panel they belong to. is that possible?

© Stack Overflow or respective owner

Related posts about java