O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Monitoring Mouse Events

In the next applet, we'll illustrate monitoring mouse events such as the mouse moving, entering, and exiting an applet. This particular applet—called EventMonitorApplet—also monitors mouse up and down events and prints information about each event. EventMonitorApplet extends the Applet class (as do all applets). It includes an EventPrinter class that checks to see if an event is a mouse event, and if so, its print method prints which mouse event occurred. The EventMonitorApplet includes an instance of EventPrinter that is both public and static. It is public because both EventMonitor and EventPrinter classes use it. It is static because only one EventPrinter is required. Note that this applet is set up just like the

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required