Extending MouseAdapter
The application of Figs. 12.31–12.32 demonstrates how to determine the number of mouse clicks (i.e., the click count) and how to distinguish between the different mouse buttons. The event listener in this application is an object of inner class MouseClickHandler
(Fig. 12.31, lines 25–46) that extends MouseAdapter
, so we can declare just the mouseClicked
method we need in this example.
Get Java™ How To Program (Early Objects), Tenth Edition 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.