Some general observations: When you implement an interface you are required to implement every method defined in the interface. Extending an adapter class allows you to implement only the methods you are interested in. This is a convenience. See General Information about Writing Event Listeners for more, especially the section Event Adapters.
Options: 1 - For simple programs you can have your class implement an EventListener interface, eg, ActionListener. And of course we must implement all the methods defined in the interface.
2 - If we need to keep a reference to a listener we can use either an outer class or a named inner class. There are two ways to do a named inner class:
3 - For a one–time use with no need to refer to the listener, ie, we don't need/want a reference to the listener, we have the anonymous inner class. This is what I used in the first reply above. And I used a WindowAdapter for the WindowListener. If I had specified a WindowListener instead I would have been required to implement the other methods within the listener.
For more on inner class listeners see Inner Classes and Anonymous Inner Classes section on the last (link above) page. [ June 16, 2004: Message edited by: Craig Wood ]