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

Of Mice and Buttons

Different platforms typically use different types of mice. Macintosh systems normally use a one-button mouse, PCs a two- or three-button mouse, and SPARC® systems a three-button mouse. Java deals with these differences by assuming that all mice have one button. For example, the AWT distinguishes only one mouse up event. Correspondingly, there is only one method (mouseUp()) to account for this. There's no mouseUp1(), mouseUp2(), mouseUp3() to account for the different mouse buttons that might initiate an event. This is also the case for mouse events such as a mouse down or mouse drag.

As we've seen in the whichMouseButton method above, the mechanism employed to determine which mouse button triggered an event is to look at 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