15.14. Review Questions

 
[Page 486 ( continued )]

Review Questions

Sections 14.2 “14.3

14.1 Can a button fire a WindowEvent ? Can a button fire a MouseEvent ? Can a button fire an ActionEvent ?
14.2 Why must a listener be an instance of an appropriate listener interface? Explain how to register a listener object and how to implement a listener interface.
14.3 Can a source have multiple listeners? Can a listener listen on multiple sources? Can a source be a listener for itself?
14.4 How do you override a method defined in the listener interface? Do you need to override all the methods defined in the listener interface?
14.5 Can an inner class be used in a class other than the class in which it nests ?
14.6 Can the modifiers public , private , and static be used on inner classes?
14.7 If class A is an inner class in class B , what is the .class file for A ? If class B contains two anonymous inner classes, what are the .class file names for these two classes?

[Page 487]
14.8 What is wrong in the following code?

Sections 14.4 “14.5

14.9 What method do you use to get the source of an event? What method do you use to get the timestamp for an action event, a mouse event or a key event? What method do you use to get the mouse point position for a mouse event? What method do you use to get the key character for a key event?
14.10 What is the listener interface for mouse pressed, released, clicked, entered, and exited? What is the listener interface for mouse moved and dragged?
14.11 Does every key in the keyboard have a Unicode? Is a key code in the KeyEvent class equivalent to a Unicode?
14.12 Is the keyPressed handler invoked after a key is pressed? Is the keyReleased handler invoked after a key is released? Is the keyTyped handler invoked after any key is typed?

Section 14.6 (Optional) Animation Using the Timer Class

14.13 How do you create a timer? How do you start a timer? How do you stop a timer?
14.14 Does the Timer class have a no-arg constructor? Can you add multiple listeners to a timer?
 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net