11.5. The Standard Event Listeners

Table 11.1 summarizes the 11 AWT event listeners. Each is described in more detail later in this section. The method to register a listener has the same name as the listener, prefixed by “add”. For example, use addMouseListener to attach a MouseListener, addComponentListener to attach a ComponentListener, etc. For each addXxxListener there is a corresponding removeXxxListener method. In addition to the 11 AWT listener types, Swing defines some of its own. Many of these are discussed in the chapters on Swing. Note that all listener classes that contain more than one method have a corresponding adapter class that contains empty implementations of all the methods. Since you always implement at least one of the ...

Get Core Web Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.