Swing WindowEvent类

此类的对象表示窗口状态的更改。此低级事件由Window对象在打开,关闭,激活,取消激活,图标化或取消图标化时生成,或者当焦点转移到或转出时生成窗口。

类声明

以下是java.awt.event.WindowEvent类的声明 -

public class WindowEvent
   extends ComponentEvent

字段

以下是java.awt.event.WindowEvent类的字段 -

  • static int WINDOW_ACTIVATED - 窗口激活的事件类型。
  • static int WINDOW_CLOSED - 窗口关闭事件。
  • static int WINDOW_CLOSING - “窗口正在关闭”事件。
  • static int WINDOW_DEACTIVATED - 窗口已停用的事件类型。
  • static int WINDOW_DEICONIFIED - 窗口取消图标事件类型。
  • static int WINDOW_FIRST - 用于窗口事件的ID范围中的第一个数字。
  • static int WINDOW_GAINED_FOCUS - 窗口获取焦点事件类型。
  • static int WINDOW_ICONIFIED - 窗口图标化事件。
  • static int WINDOW_LAST - 用于窗口事件的ID范围中的最后一个数字。
  • static int WINDOW_LOST_FOCUS - 窗口丢失焦点事件类型。
  • static int WINDOW_OPENED - 窗口打开事件。
  • static int WINDOW_STATE_CHANGED - 窗口状态更改的事件类型。

类构造函数

编号 构造函数 描述
1 WindowEvent(Window source, int id) 构造一个WindowEvent对象。
2 WindowEvent(Window source, int id, int oldState, int newState) 使用指定的上一个和新窗口状态构造一个WindowEvent对象。
3 WindowEvent(Window source, int id, Window opposite) 使用指定的相对Window构造一个WindowEvent对象。
4 WindowEvent(Window source, int id, Window opposite, int oldState, int newState) 构造一个WindowEvent对象。

类方法

编号 类方法 描述
1 int getNewState() 对于WINDOW_STATE_CHANGED事件,返回窗口的新状态。
2 int getOldState() 对于WINDOW_STATE_CHANGED事件,返回窗口的先前状态。
3 Window getOppositeWindow() 返回此焦点或激活更改中涉及的另一个Window。
4 Window getWindow() 返回事件的发起者。
5 String paramString() 返回标识此事件的参数字符串。

方法继承

该类继承以下类中的方法 -

  • java.awt.event.ComponentEvent
  • java.awt.AWTEvent
  • java.util.EventObject
  • java.lang.Object

上一篇: Swing事件类 下一篇: Swing事件监听器