Since java.awt.Window
is a subclass of
java.awt.Component
, a Window
,
Frame
or Dialog
can fire events. In particular
it fires WindowEvent
s. There are seven of these:
WindowEvent.WINDOW_ACTIVATED
WindowEvent.WINDOW_CLOSED
WindowEvent.WINDOW_CLOSING
WindowEvent.WINDOW_DEACTIVATED
WindowEvent.WINDOW_DEICONIFIED
WindowEvent.WINDOW_ICONIFIED
WindowEvent.WINDOW_OPENED
To respond to these events you register a
WindowListener
object with the window. The object must
implement the WindowListener
interface and include
these methods:
public void windowOpened(WindowEvent evt)
public void windowClosing(WindowEvent evt)
public void windowClosed(WindowEvent evt)
public void windowIconified(WindowEvent evt)
public void windowDeiconified(WindowEvent evt)
public void windowActivated(WindowEvent evt)
public void windowDeactivated(WindowEvent evt)