Exercises
-
Review the javadoc pages for classes and interfaces in package java.awt.event. How many classes and interfaces exist?
-
Write a program that displays a JFrame. Install a key listener and the three kinds of mouse listener on the frame. Print out each event that is received. Are you surprised at the number of mouse motion events?
-
The source code for the event interfaces and their methods can also be reviewed in the directory
$JAVAHOME/src/java/awt/event. ($JAVAHOME is the location where you installed the release. On my system it isC:\jdk1.4.)Take a look at MouseWheelEvent.java, which shows how support for the new mouse wheels was added in JDK 1.4. What information can a mouse wheel event convey?
-
After doing the previous exercise, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access