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, ...
Get Just Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.