Newbie simple question

Discussion in 'Java' started by Dev_Prog, Mar 6, 2004.

  1. Dev_Prog

    Dev_Prog Guest

    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.
     
    Dev_Prog, Mar 6, 2004
    #1
    1. Advertising

  2. 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/tutorial/uiswing/misc/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
     
    Christophe Vanfleteren, Mar 6, 2004
    #2
    1. Advertising

  3. 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
     
    Andrew Thompson, Mar 6, 2004
    #3
  4. Dev_Prog

    nos Guest

    When you create the object just
    put in your own unique identifier.

    "Andrew Thompson" <> wrote in message
    news:10v6o8vfmrk9e$.1efg0e8c63anq$...
    > 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
     
    nos, Mar 6, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    565
  2. Kevin Spencer

    Re: Simple Simple question!!!

    Kevin Spencer, Jun 25, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    673
    Kevin Spencer
    Jun 25, 2004
  3. Daniel Frey

    Simple Question - Simple Answer?

    Daniel Frey, Dec 28, 2004, in forum: XML
    Replies:
    4
    Views:
    846
    Daniel Frey
    Jan 12, 2005
  4. Oli

    simple simple question

    Oli, Jan 26, 2004, in forum: ASP General
    Replies:
    10
    Views:
    379
    Roland Hall
    Jan 26, 2004
  5. Jerry C.
    Replies:
    8
    Views:
    252
    Uri Guttman
    Nov 23, 2003
Loading...

Share This Page