This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes getID() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getID() " Watch "getID() " New topic


Jennifer Wallace
Ranch Hand

Joined: Nov 30, 2001
Posts: 102
What is the number returned by getID() of the class java.awt.AWTEvent
API says getID() returns the type of an event.
What is meant by "type of an event" ? How do we know what are the different "types" correlating to the integers(int) returned by getID()
Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
The event handling model in Java changed with the
release of JDK 1.1 five years ago or so. Before
that, event handling used the Event object id field
like so:

That example is from the handleEvent() method in
an old JDK 1.0 example program from Sun.
Nowadays we use Adapters or Listeners to catch and
handle the events of interest without resorting to
stuff like that. (We had to ask the event what its
target was, too.)
If you are interested in that older stuff, Sun still
has the examples available online.
I suggest you work through their online Java tutorial.
It really is a good introduction to Java, and the
online version is free. It can answer questions like
this and your other post on enableEvents() without
you having to wait and check for replies and wait
and check for replies and wait...
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: getID()
Similar Threads
getSource() method of an ActionEvent
Passed SCJP2 with 93%
How to convert java.util.List to Array?.
how we can get notification of an event listener at web browser