Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Newbie simple question

Reply
Thread Tools

Newbie simple question

 
 
Dev_Prog
Guest
Posts: n/a
 
      03-06-2004
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.
 
Reply With Quote
 
 
 
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      03-06-2004
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
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      03-06-2004
On 5 Mar 2004 17:41:00 -0800, 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,


You can get the component that fired
the action. How much more unique do
you need it?

--
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
nos
Guest
Posts: n/a
 
      03-06-2004
When you create the object just
put in your own unique identifier.

"Andrew Thompson" <(E-Mail Removed)> wrote in message
news:10v6o8vfmrk9e$.1efg0e8c63anq$(E-Mail Removed). ..
> On 5 Mar 2004 17:41:00 -0800, 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,

>
> You can get the component that fired
> the action. How much more unique do
> you need it?
>
> --
> Andrew Thompson
> * http://www.PhySci.org/ Open-source software suite
> * http://www.PhySci.org/codes/ Web & IT Help
> * http://www.1point1C.org/ Science & Technology



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple region code question... simple answer?? joseph.greer@gmail.com DVD Video 7 01-26-2007 09:07 PM
Simple Question - Simple Answer? Daniel Frey XML 4 01-12-2005 04:25 PM
Re: Simple Simple question!!! Kevin Spencer ASP .Net 0 06-25-2004 05:25 PM
Re: Simple Simple question!!! ashelley@inlandkwpp.com ASP .Net 0 06-25-2004 04:18 PM
dumb newbie question (or newbie dumb question) Jerry C. Perl Misc 8 11-23-2003 04:11 AM



Advertisments