The object of this class represents the change in state of a window.This low-level event is generated by a Window object when it is opened, closed, activated, deactivated, iconified, or deiconified, or when focus is transfered into or out of the Window.

类声明

Following is the declaration for java.awt.event.WindowEvent class:

  1. public class WindowEvent
  2. extends ComponentEvent

Field

Following are the fields for java.awt.event.WindowEvent class:

  • static int WINDOW_ACTIVATED —The window-activated event type.

  • static int WINDOW_CLOSED — The window closed event.

  • static int WINDOW_CLOSING — The "window is closing" event.

  • static int WINDOW_DEACTIVATED —The window-deactivated event type.

  • static int WINDOW_DEICONIFIED — The window deiconified event type.

  • static int WINDOW_FIRST — The first number in the range of ids used for window events.

  • static int WINDOW_GAINED_FOCUS — The window-gained-focus event type.

  • static int WINDOW_ICONIFIED — The window iconified event.

  • static int WINDOW_LAST — The last number in the range of ids used for window events.

  • static int WINDOW_LOST_FOCUS — The window-lost-focus event type.

  • static int WINDOW_OPENED — The window opened event.

  • static int WINDOW_STATE_CHANGED — The window-state-changed event type.

类的构造函数

S.N.Constructor & Description
1WindowEvent(Window source, int id) Constructs a WindowEvent object.
2WindowEvent(Window source, int id, int oldState, int newState) Constructs a WindowEvent object with the specified previous and new window states.
3WindowEvent(Window source, int id, Window opposite) Constructs a WindowEvent object with the specified opposite Window.
4WindowEvent(Window source, int id, Window opposite, int oldState, int newState) Constructs a WindowEvent object.

类方法

S.N.Method & Description
1int getNewState() For WINDOW_STATE_CHANGED events returns the new state of the window.
2int getOldState() For WINDOW_STATE_CHANGED events returns the previous state of the window.
3WindowgetOppositeWindow() Returns the other Window involved in this focus or activation change.
4WindowgetWindow() Returns the originator of the event.
5StringparamString() Returns a parameter string identifying this event.

方法继承

This class inherits methods from the following classes:

  • java.awt.event.ComponentEvent

  • java.awt.AWTEvent

  • java.util.EventObject

  • java.lang.Object