Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

awt events

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the class java.awt.AWTEvent,which is the parent class upon which jdk1.1 awt events are based there is a method called getID(),
which phrase most accerrately describes in significance of the reture value of this method?
my answer is A,E possibly F
what is wrong with me if I am wrong...
A.It is a reference to the object directly affected by the cause of the event.
B.It is an indication of the nature of the cause of the event.
C.It is an indication of the position of the mouse when it caused the event.
D.In the case of a mouse click,it is an indication of the text under the mouse at the time of the event.
E.It tells the state of certain keys on the keybord at the time of the event.
F.It is an indication of the time at which the event occurred.
 
Thandapani Saravanan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To me, only A seems to be right. Because, for other answers E and F there are seperate methods in the subclasses. Is it right?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes , as you said A is correct answer to my question, but which methods are correct for E and F...
 
Thandapani Saravanan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E. The class KeyEvent has methods like getKeyChar(), getKeyCode() and getKeyText().
F. In Java 1.0, there used to be a variable in Event class that has the timestamp of any event. The variable name is 'when'. But the present (post 1.1) EventObject, AWTEvent and its subclasses supersede the Event class. I doubt whether the variable when is still there.
 
Thandapani Saravanan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops. I now realize there is a method in InputEvent class that returns the timestamp of when the event occurred. Check this:
public long getWhen()
 
sri k Ganjam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is B the getID() just returns the type of the event generated. i.e., in the case of window events it will return the constants equivalent to Window.ICONIFIED, Window.DEICONIFIED so on.
I've got this question in my SCJP exam.
[This message has been edited by sri k Ganjam (edited January 13, 2000).]
 
rajapratap
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know the method getID() returns the ID of the event.An event's ID is an int that specifies the exact nature of the event.
So the answer must be B.
 
Something must be done about this. Let's start by reading this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!