Java Reference
In-Depth Information
GExercise R9.17. From a programmer's perspective, what is the most
important difference between the user interfaces of a console application
and a graphical application?
GExercise R9.18. What is the difference between an
ActionEvent
and a
MouseEvent
?
GExercise R9.19. Why does the
ActionListener
interface have only
one method, whereas the
MouseListener
has five methods?
GExercise R9.20. Can a class be an event source for multiple event types?
If so, give an example.
GExercise R9.21. What information does an action event object carry?
What additional information does a mouse event object carry?
GExercise R9.22. Why are we using inner classes for event listeners? If
Java did not have inner classes, could we still implement event
listeners? How?
GExercise R9.23. What is the difference between the
paintComponent
and
repaint
methods?
GExercise R9.24. What is the difference between a frame and a panel?
Additional review exercises are available in WileyPLUS.
PROGRAMMING EXERCISES
Exercise P9.1. Have the
Die
class of
Chapter 6
implement the
Measurable
interface. Generate dice, cast them, and add them to the
implementation of the
DataSet
class in
Section 9.1
. Display the average.
Exercise P9.2. Define a class
Quiz
that implements the
Measurable
interface. A quiz has a score and a letter grade (such as
B+
). Use the
implementation of the
DataSet
class in
Section 9.1
to process a
collection of quizzes. Display the average score and the quiz with the
highest score (both letter grade and score).