Dev_Prog wrote:
> Hello all,
> I started to write the code of the actionPerformed() function as part
> of implementing the ActionListener for menu and component events.
> - In the case of GUI components, I refer to the component name to
> detect the event source.
> - In the case of menu-items, I refer to the menu item displayed string
> to detect the source.
> As an old fashion coder, I wish there was some sort of unique-id
> mechanism to detect the event source, and more preferably if that
> unique-id is numeric.
> My feeling is that such unique-id would be one of the Object class
> variables as Object is the abstract of the inheritance tree.
> Can anybody throw some ideas of how to receive a unique value inside
> the actionPerformed() function from the virtual machine or the OS?
> Thanks gurus.
Use actions to solve these kinds of problems elegantly:
http://java.sun.com/docs/books/tutor...sc/action.html
No need to muck about with unique id's, as with actions, you don't really
care where the action came from, just what you have to do when it is
performed.
--
Kind regards,
Christophe Vanfleteren