WindowListener Interface:
This interface declares seven methods. The windowActivated() and windowDeactivated() methods are invoked whenever a window is activated or deactivated, correspondingly. The windowIconified() method is called if a window is iconified. When a window is deiconified, the windowDeiconified() method is called. When a window is opened or closed, the windowOpened () or windowClosed () methods are called, correspondingly. The windowClosing() method is called when a window is being closed. The common forms of these methods are
Syntax: void windowActivated(WindowEvent we)
Syntax: void windowClosed(WindowEvent we)
Syntax: void windowClosing(WindowEvent we)
Syntax: void windowDeactivates(WindowEvent we)
Syntax: void windowDeiconified(WindowEvent we)
Syntax: void windowIconified(WindowEvent we)
Syntax: void windowOpened(WindowEvent we)
programming by using the delegation event model is in fact quite simple. Only follow these two steps:
1. Implement the suitable interface in the listener so which it will receive the type of event desired.
2. Implement code to register and unregistered the listener as a recipient for the event notifications.
Note that a source may generate various types of events. Every event has to be registered separately. In addition, an object might register to various types of events, but it have to implement all of the interfaces which are need to receive these events.