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 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.