位置:首页 > Java技术 > Swing > SWING WindowEvent事件类

SWING WindowEvent事件类

这个类的对象表示一个窗口的状态的变化。这种低层次的事件所产生的一个窗口对象,当它被打开,关闭,激活,停用,图标化,或当焦点转移到窗外。

类声明

以下是声明 java.awt.event.WindowEvent类:

public class WindowEvent
   extends ComponentEvent

字段域

以下为java.awt.event.WindowEvent类字段:

  • 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. 构造函数 & 描述
1 WindowEvent(Window source, int id) 
Constructs a WindowEvent object.
2 WindowEvent(Window source, int id, int oldState, int newState) 
Constructs a WindowEvent object with the specified previous and new window states.
3 WindowEvent(Window source, int id, Window opposite) 
Constructs a WindowEvent object with the specified opposite Window.
4 WindowEvent(Window source, int id, Window opposite, int oldState, int newState) 
Constructs a WindowEvent object.

类方法

S.N. 方法 & 描述
1 int getNewState() 
For WINDOW_STATE_CHANGED events returns the new state of the window.
2 int getOldState() 
For WINDOW_STATE_CHANGED events returns the previous state of the window.
3 Window getOppositeWindow() 
Returns the other Window involved in this focus or activation change.
4 Window getWindow() 
Returns the originator of the event.
5 String paramString() 
Returns a parameter string identifying this event.

方法继承

这个类从以下类继承的方法:

  • java.awt.event.ComponentEvent

  • java.awt.AWTEvent

  • java.util.EventObject

  • java.lang.Object