EEK! A Mouse Event!

By David Wall, ITworld |  News

Last week, we built a little program that monitored windows for clicks
and drags of the mouse. We created a Canvas object that implemented the
appropriate listener classes and inserted the "listening Canvas" into
the window we wanted to monitor. The listeners told us when and where
clicks and drags took place.

This week, let's use the same general approach to monitor all
detectible mouse events, including:

* Clicks
* Drags
* Moves
* Button-presses
* Button-releases
* Entry into the monitored area
* Exit from the monitored area

Basically, we will override all the event handlers in the MouseListener
and MouseMotionListener classes and call a method called showEvent().

Join us:






Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Ask a Question