Introduction to OOP Chapter 19: Container Classes : next previous audio real text

An Example, Java Window Events

A good example is the way that window events are handled in Java. Each window maintains a list of listeners, each listener must implement a fixed interface (WindowListener).
public class CloseQuit extends WindowAdapter {
		// execute when the user clicks in the close box
	public void windowClosing (WindowEvent e) {
		System.exit(0); // halt the program
	}
}
When an event occurs the window simply runs down the list of listener, invoking the appropriate method in each. No downcasting required.
Intro OOP, Chapter 19, Slide 10