14.14 Mouse Event Handling
This section presents the MouseListener
and MouseMotionListener
event-listener interfaces for handling mouse events. Mouse events can be processed for any GUI component that derives from java.awt.Component
. The methods of interfaces MouseListener
and MouseMotionListener
are summarized in Figure 14.27. Package javax.swing.event
contains interface MouseInputListener
, which extends interfaces MouseListener
and MouseMotionListener
to create a single interface containing all the MouseListener
and MouseMotionListener
methods. The MouseListener
and MouseMotionListener
methods are called when the mouse interacts with a Component
if appropriate event-listener objects are registered for that Component
.
Each of the mouse event-handling ...
Get Java How to Program (early objects), 9/e 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.