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

AWT Adapters

Some of the interfaces listed in Table 9-3 require implementing a fair number of methods. Listeners, a good percentage of the time, are only interested in implementing a small subset of the methods defined by listener interfaces. For instance, it is common to implement WindowListener.windowClosing() to handle the closing of the window, without any interest in the other six events defined by the WindowListener interface.

To free developers from having to implement every method defined in a listener interface, the AWT provides a number of adapter classes that provide no-op implementations of the methods defined in the appropriate interface. For example, java.awt.event.MouseAdapter implements all of the methods defined in java.awt.event.MouseListener ...

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