public class WindowEvent extends ComponentEvent
 该事件被传递给每个WindowListener或WindowAdapter对象,其注册使用窗口的addWindowListener方法接收此类事件。 ( WindowAdapter对象实现WindowListener接口。)每个这样的侦听器对象在事件发生时得到这个WindowEvent 。 
 如果未指定的行为将引起id任何特定的参数WindowEvent实例不在范围从WINDOW_FIRST到WINDOW_LAST 。 
WindowAdapter , WindowListener , Tutorial: Writing a Window Listener , Serialized Form 
       | Modifier and Type | Field and Description | 
|---|---|
| static int | WINDOW_ACTIVATED
              窗口激活的事件类型。 
             | 
| static int | WINDOW_CLOSED
              窗户关闭事件。 
             | 
| static int | WINDOW_CLOSING
              “窗口正在关闭”事件。 
             | 
| static int | WINDOW_DEACTIVATED
              窗口停用事件类型。 
             | 
| static int | WINDOW_DEICONIFIED
              窗口deiconified事件类型。 
             | 
| static int | WINDOW_FIRST
              用于窗口事件的ids范围中的第一个数字。 
             | 
| 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
              窗口状态更改的事件类型。 
             | 
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWNACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASKsource| Constructor and Description | 
|---|
| WindowEvent(Window source, int id)
              构造一个 
              WindowEvent对象。 | 
| WindowEvent(Window source, int id, int oldState, int newState)
              构造具有 
              WindowEvent的上一个和新的窗口状态的WindowEvent对象。 | 
| WindowEvent(Window source, int id, Window opposite)
              构造一个 
              WindowEvent对象与指定的对面Window。 | 
| WindowEvent(Window source, int id, Window opposite, int oldState, int newState)
              构造一个 
              WindowEvent对象。 | 
| Modifier and Type | Method and Description | 
|---|---|
| int | getNewState()
              对于 
              WINDOW_STATE_CHANGED事件返回窗口的新状态。 | 
| int | getOldState()
              对于 
              WINDOW_STATE_CHANGED事件返回窗口的先前状态。 | 
| Window | getOppositeWindow()
              返回此焦点或激活更改中涉及的其他窗口。 
             | 
| Window | getWindow()
              返回事件的发起者。 
             | 
| String | paramString()
              返回标识此事件的参数字符串。 
             | 
getComponentgetSourcepublic static final int WINDOW_FIRST
@Native public static final int WINDOW_OPENED
@Native public static final int WINDOW_CLOSING
@Native public static final int WINDOW_CLOSED
@Native public static final int WINDOW_ICONIFIED
@Native public static final int WINDOW_DEICONIFIED
@Native public static final int WINDOW_ACTIVATED
@Native public static final int WINDOW_DEACTIVATED
@Native public static final int WINDOW_GAINED_FOCUS
@Native public static final int WINDOW_LOST_FOCUS
@Native public static final int WINDOW_STATE_CHANGED
public static final int WINDOW_LAST
public WindowEvent(Window source, int id, Window opposite, int oldState, int newState)
WindowEvent对象。 
            此方法抛出IllegalArgumentException如果source是null 。 
source - 发起事件的 
            Window对象 
           id - 指示事件类型的整数。 
            有关允许值的信息,请参阅WindowEvent的类说明 
           opposite - 涉及焦点或激活更改的其他窗口,或 
            null 
           oldState - 窗口状态更改事件的窗口的上一个状态。 
            关于#getOldState()的值,请参见#getOldState() 
           newState - 窗口状态更改事件的窗口的新状态。 
            有关允许值,请参见#getNewState() 
           IllegalArgumentException - 如果 
            source为空 
           getWindow() , 
            AWTEvent.getID() , 
            getOppositeWindow() , 
            getOldState() , 
            getNewState() 
           public WindowEvent(Window source, int id, Window opposite)
WindowEvent对象,其指定的对面为Window 。 
           对面的Window是另一个Window涉及到这个焦点或激活的变化。 
           对于WINDOW_ACTIVATED或WINDOW_GAINED_FOCUS事件,这是Window失去激活或焦点。 
           对于WINDOW_DEACTIVATED或WINDOW_LOST_FOCUS事件,这是Window中赢得激活或焦点。 
           如果本机应用程序发生此焦点更改,使用Java应用程序在不同的VM中,或者没有其他的Window ,那么相对的窗口是null 。 
            此方法抛出IllegalArgumentException如果source是null 。 
source - 发起事件的 
            Window对象 
           id - 指示事件类型的整数。 
            有关允许值的信息,请参阅WindowEvent的类说明 。 
            预期该构造函数不会被用于其他的另外的WINDOW_ACTIVATED WINDOW_DEACTIVATED , WINDOW_GAINED_FOCUS或WINDOW_LOST_FOCUS 。 
            WindowEvent类型,因为其他事件类型的对面Window将始终是null 。 
           opposite - 其他 
            Window涉及到焦点或激活变化,或 
            null 
           IllegalArgumentException - 如果 
            source为空 
           getWindow() , 
            AWTEvent.getID() , 
            getOppositeWindow() 
           public WindowEvent(Window source, int id, int oldState, int newState)
WindowEvent的上一个和新窗口状态的WindowEvent对象。 
            此方法抛出IllegalArgumentException如果source是null 。 
source - 发起事件的 
            Window对象 
           id - 表示事件类型的整数。 
            有关允许值的信息,请参阅WindowEvent的类说明 。 
            预期此构造函数将不会用于其他类型的其他WINDOW_STATE_CHANGED WindowEvent ,因为以前的和新的窗口状态对于其他事件类型是无意义的。 
           oldState - 表示前一窗口状态的整数。 
            关于允许值,请参阅#getOldState() 
           newState - 表示新窗口状态的整数。 
            关于允许值,请参见#getNewState() 
           IllegalArgumentException - 如果 
            source为空 
           getWindow() , 
            AWTEvent.getID() , 
            getOldState() , 
            getNewState() 
           public WindowEvent(Window source, int id)
WindowEvent对象。 
            此方法抛出IllegalArgumentException如果source是null 。 
source - 发起事件的 
            Window对象 
           id - 指示事件类型的整数。 
            有关允许值的信息,请参阅WindowEvent的类说明 。 
           IllegalArgumentException - 如果 
            source为空 
           getWindow() , 
            AWTEvent.getID() 
           public Window getWindow()
public Window getOppositeWindow()
public int getOldState()
WINDOW_STATE_CHANGED事件返回窗口的先前状态。 
           状态表示为按位掩码。 
           NORMAL ICONIFIED MAXIMIZED_HORIZ MAXIMIZED_VERT MAXIMIZED_BOTH MAXIMIZED_HORIZ和MAXIMIZED_VERT 。 Frame.getExtendedState() 
           public int getNewState()
WINDOW_STATE_CHANGED事件返回窗口的新状态。 
           状态表示为按位掩码。 
           NORMAL ICONIFIED MAXIMIZED_HORIZ MAXIMIZED_VERT MAXIMIZED_BOTH MAXIMIZED_HORIZ和MAXIMIZED_VERT 。 Frame.getExtendedState() 
           public String paramString()
paramString在类别 
            ComponentEvent 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.