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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access