• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Events that components can generate

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been taking some tests and have been making regular mistakes in answering the question that asks about the events a component can generate...
Here is an example :
Which interface implementations can you add as listeners for a
TextField object?
Select all valid answers.
a) ActionListener
b) FocusListener
c) MouseMotionListener
d) WindowListener
e) ContainerListener
a, b, and c. The answers d and e are not valid for TextField objects.
Acording to my knowledge of Books I would be interested in seeing only two answers that is, ItemEvent and Action Event....e.g, R/H mentions that Textfields generate these two only.....
Can somebody suggest a place where I can see a whole list of events a componenet may generate. I checked out the specs, but they dont seem to list it down...
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No JD.TextFields do not generate ItemEvents.They can generate ActionEvents and TextEvents.I am not sure about MouseMotionEvents.
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JD, text field do not generate item events and it is not mentioned in R&H also. Which version of R&H do you have? I have the fifth printing and in this it is mentioned that
both text fields and text areas generate Text and Key events. Additionally, text fields generate Action events on receipt of an Enter keystroke.
This is the last sentence on page 331. If it is not the same in the book you have, please check the errata at http://www.sybex.com/cgi-bin/rd_err_temp.pl?2700err.html
The same feature is also mentioned in the API documentation under TextField class. You can check this too.
I hope this helps you.
Suma
[This message has been edited by Suma Narayan (edited June 12, 2000).]
 
John Dell'Oso
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suma,
I am sorry, about that ItemEvent part....its Action Event in the book too.
Ok , coming back to the question I posted. That was from a mock test. It said MouseMotionListener too as an answer...How is that?
Here is ANOTHER question from the same exam..
Which Listener interfaces can you add to a TextArea object?
a) TextListener
b) ActionListener
c) MouseMotionListener
d) MouseListener
e) ComponentListener
"
answer :a, c, d, and e. b is not correct, because you cannot add an ActionListener to a
TextArea. (You can add an ActionListener to a TextField, however.)
"
Again my answers would be...'a' only as per Heller....HOW AM I SUPPOSED TO FIGURE OUT THE REST...EVEN THE JLS, does not mention this.I would appreciate any help regarding this.
thanks in advance.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have also run into these types of questions. I have also had the same questions/problems.
A good source to review and memorize is:
Java 2 Certification Study Guide. aka RHE

read chapt. 10.. memorize pg. memorize 298 thru 301.
read chapt. 11... memorize your components
Always remember to apply common sence.
Are we having fun yet?
Enjoy the day,
Monty /
 
Suma Narayan
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JD,
Can you please tell us the mock exam name.
Thanks.
Suma
 
Suma Narayan
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi JD,
Check this site. It is Tony Alicea's site. item#3 gives the table of events generated by AWT components.
Suma

[This message has been edited by Suma Narayan (edited June 14, 2000).]
reply
    Bookmark Topic Watch Topic
  • New Topic