Introduction to OOP | Chapter 19: Container Classes : | next | previous | audio | real | text |
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.