• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event Listener on Dynamic Objects

Gregg Bolinger
Ranch Hand
Posts: 15304
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing an App where the user will add JButton's dynamically to a JPanel. The Buttons will not actually work as in Click the Button and an event happens. Rather they will represent something completely different. However, I still need to know when the user has clicked on it in order to know if it is the current Focused Button.
What I need to know is what is the best method to keep track of the added Buttons (Hashmap, Vector, Properties, etc) AND how do I dynamically register a Listener on the Button as it is created and keep that seperate from the other Button(s).
If this doesn't make sense, let me know and I will reitterate.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic