Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
Sample
Document
Class java.awt.event.WindowEvent
Inherited members: ShowHide
Deprecated: ShowHide
View: ClientSubclassPackageImplementation
java.awt.event

Class WindowEvent

  • java.lang.Object
    • java.util.EventObject
      • java.awt.AWTEvent
        • java.awt.event.ComponentEvent
          • java.awt.event.WindowEvent
  • All Implemented Interfaces:
    java.io.Serializable
    public class WindowEvent extends ComponentEvent
    A low-level event that indicates that a window has changed its status. 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.

    The event is passed to every WindowListener or WindowAdapter object which registered to receive such events using the window's addWindowListener method. (WindowAdapter objects implement the WindowListener interface.) Each such listener object gets this WindowEvent when the event occurs.

    An unspecified behavior will be caused if the id parameter of any particular WindowEvent instance is not in the range from WINDOW_FIRST to WINDOW_LAST.

    Since:
    JDK1.1
    See Also:
    WindowAdapter, WindowListener, Tutorial: Writing a Window Listener, Serialized Form
    • Fields 
      Modifier and Type Field and Description
      Inherited member indicator ACTION_EVENT_MASK Reveal DetailHide Detail
      static long ACTION_EVENT_MASK
      The event mask for selecting action events.
      public static final long ACTION_EVENT_MASK
      The event mask for selecting action events.
      See Also:
      Constant Field Values
      Inherited member indicator ADJUSTMENT_EVENT_MASK Reveal DetailHide Detail
      static long ADJUSTMENT_EVENT_MASK
      The event mask for selecting adjustment events.
      public static final long ADJUSTMENT_EVENT_MASK
      The event mask for selecting adjustment events.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_EVENT_MASK Reveal DetailHide Detail
      static long COMPONENT_EVENT_MASK
      The event mask for selecting component events.
      public static final long COMPONENT_EVENT_MASK
      The event mask for selecting component events.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_FIRST Reveal DetailHide Detail
      static int COMPONENT_FIRST
      The first number in the range of ids used for component events.
      public static final int COMPONENT_FIRST
      The first number in the range of ids used for component events.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_HIDDEN Reveal DetailHide Detail
      static int COMPONENT_HIDDEN
      This event indicates that the component was rendered invisible.
      public static final int COMPONENT_HIDDEN
      This event indicates that the component was rendered invisible.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_LAST Reveal DetailHide Detail
      static int COMPONENT_LAST
      The last number in the range of ids used for component events.
      public static final int COMPONENT_LAST
      The last number in the range of ids used for component events.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_MOVED Reveal DetailHide Detail
      static int COMPONENT_MOVED
      This event indicates that the component's position changed.
      public static final int COMPONENT_MOVED
      This event indicates that the component's position changed.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_RESIZED Reveal DetailHide Detail
      static int COMPONENT_RESIZED
      This event indicates that the component's size changed.
      public static final int COMPONENT_RESIZED
      This event indicates that the component's size changed.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_SHOWN Reveal DetailHide Detail
      static int COMPONENT_SHOWN
      This event indicates that the component was made visible.
      public static final int COMPONENT_SHOWN
      This event indicates that the component was made visible.
      See Also:
      Constant Field Values
      Inherited member indicator consumed Reveal DetailHide Detail
      protected boolean consumed
      Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not.
      protected boolean consumed
      Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not. Semantic events always have a 'true' value since they were generated by the peer in response to a low-level event.
      See Also:
      AWTEvent.consume(), AWTEvent.isConsumed()
      Inherited member indicator CONTAINER_EVENT_MASK Reveal DetailHide Detail
      static long CONTAINER_EVENT_MASK
      The event mask for selecting container events.
      public static final long CONTAINER_EVENT_MASK
      The event mask for selecting container events.
      See Also:
      Constant Field Values
      Inherited member indicator FOCUS_EVENT_MASK Reveal DetailHide Detail
      static long FOCUS_EVENT_MASK
      The event mask for selecting focus events.
      public static final long FOCUS_EVENT_MASK
      The event mask for selecting focus events.
      See Also:
      Constant Field Values
      Inherited member indicator HIERARCHY_BOUNDS_EVENT_MASK Reveal DetailHide Detail
      static long HIERARCHY_BOUNDS_EVENT_MASK
      The event mask for selecting hierarchy bounds events.
      public static final long HIERARCHY_BOUNDS_EVENT_MASK
      The event mask for selecting hierarchy bounds events.
      See Also:
      Constant Field Values
      Inherited member indicator HIERARCHY_EVENT_MASK Reveal DetailHide Detail
      static long HIERARCHY_EVENT_MASK
      The event mask for selecting hierarchy events.
      public static final long HIERARCHY_EVENT_MASK
      The event mask for selecting hierarchy events.
      See Also:
      Constant Field Values
      Inherited member indicator id Reveal DetailHide Detail
      protected int id
      The event's id.
      protected int id
      The event's id.
      See Also:
      AWTEvent.getID(), AWTEvent.AWTEvent(java.lang.Object, int)
      Inherited member indicator INPUT_METHOD_EVENT_MASK Reveal DetailHide Detail
      static long INPUT_METHOD_EVENT_MASK
      The event mask for selecting input method events.
      public static final long INPUT_METHOD_EVENT_MASK
      The event mask for selecting input method events.
      See Also:
      Constant Field Values
      Inherited member indicator INVOCATION_EVENT_MASK Reveal DetailHide Detail
      static long INVOCATION_EVENT_MASK
      The event mask for selecting invocation events.
      public static final long INVOCATION_EVENT_MASK
      The event mask for selecting invocation events.
      See Also:
      Constant Field Values
      Inherited member indicator ITEM_EVENT_MASK Reveal DetailHide Detail
      static long ITEM_EVENT_MASK
      The event mask for selecting item events.
      public static final long ITEM_EVENT_MASK
      The event mask for selecting item events.
      See Also:
      Constant Field Values
      Inherited member indicator KEY_EVENT_MASK Reveal DetailHide Detail
      static long KEY_EVENT_MASK
      The event mask for selecting key events.
      public static final long KEY_EVENT_MASK
      The event mask for selecting key events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_EVENT_MASK
      The event mask for selecting mouse events.
      public static final long MOUSE_EVENT_MASK
      The event mask for selecting mouse events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_MOTION_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_MOTION_EVENT_MASK
      The event mask for selecting mouse motion events.
      public static final long MOUSE_MOTION_EVENT_MASK
      The event mask for selecting mouse motion events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_WHEEL_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_WHEEL_EVENT_MASK
      The event mask for selecting mouse wheel events.
      public static final long MOUSE_WHEEL_EVENT_MASK
      The event mask for selecting mouse wheel events.
      Since:
      1.4
      See Also:
      Constant Field Values
      Inherited member indicator PAINT_EVENT_MASK Reveal DetailHide Detail
      static long PAINT_EVENT_MASK
      The event mask for selecting paint events.
      public static final long PAINT_EVENT_MASK
      The event mask for selecting paint events.
      See Also:
      Constant Field Values
      Inherited member indicator RESERVED_ID_MAX Reveal DetailHide Detail
      static int RESERVED_ID_MAX
      The maximum value for reserved AWT event IDs.
      public static final int RESERVED_ID_MAX
      The maximum value for reserved AWT event IDs. Programs defining their own event IDs should use IDs greater than this value.
      See Also:
      Constant Field Values
      Inherited member indicator source Reveal DetailHide Detail
      protected java.lang.Object source
      The object on which the Event initially occurred.
      protected transient java.lang.Object source
      The object on which the Event initially occurred.
      Inherited member indicator TEXT_EVENT_MASK Reveal DetailHide Detail
      static long TEXT_EVENT_MASK
      The event mask for selecting text events.
      public static final long TEXT_EVENT_MASK
      The event mask for selecting text events.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_ACTIVATED Reveal DetailHide Detail
      static int WINDOW_ACTIVATED
      The window-activated event type.
      public static final int WINDOW_ACTIVATED
      The window-activated event type. This event is delivered when the Window becomes the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_CLOSED Reveal DetailHide Detail
      static int WINDOW_CLOSED
      The window closed event.
      public static final int WINDOW_CLOSED
      The window closed event. This event is delivered after the window has been closed as the result of a call to dispose.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_CLOSING Reveal DetailHide Detail
      static int WINDOW_CLOSING
      The "window is closing" event.
      public static final int WINDOW_CLOSING
      The "window is closing" event. This event is delivered when the user attempts to close the window from the window's system menu. If the program does not explicitly hide or dispose the window while processing this event, the window close operation will be cancelled.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_DEACTIVATED Reveal DetailHide Detail
      static int WINDOW_DEACTIVATED
      The window-deactivated event type.
      public static final int WINDOW_DEACTIVATED
      The window-deactivated event type. This event is delivered when the Window is no longer the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_DEICONIFIED Reveal DetailHide Detail
      static int WINDOW_DEICONIFIED
      The window deiconified event type.
      public static final int WINDOW_DEICONIFIED
      The window deiconified event type. This event is delivered when the window has been changed from a minimized to a normal state.
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_EVENT_MASK
      The event mask for selecting window events.
      public static final long WINDOW_EVENT_MASK
      The event mask for selecting window events.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_FIRST Reveal DetailHide Detail
      static int WINDOW_FIRST
      The first number in the range of ids used for window events.
      public static final int WINDOW_FIRST
      The first number in the range of ids used for window events.
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_FOCUS_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_FOCUS_EVENT_MASK
      The event mask for selecting window focus events.
      public static final long WINDOW_FOCUS_EVENT_MASK
      The event mask for selecting window focus events.
      Since:
      1.4
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_GAINED_FOCUS Reveal DetailHide Detail
      static int WINDOW_GAINED_FOCUS
      The window-gained-focus event type.
      public static final int WINDOW_GAINED_FOCUS
      The window-gained-focus event type. This event is delivered when the Window becomes the focused Window, which means that the Window, or one of its subcomponents, will receive keyboard events.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_ICONIFIED Reveal DetailHide Detail
      static int WINDOW_ICONIFIED
      The window iconified event.
      public static final int WINDOW_ICONIFIED
      The window iconified event. This event is delivered when the window has been changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property.
      See Also:
      Frame.setIconImage(java.awt.Image), Constant Field Values
      Ordinary member indicator WINDOW_LAST Reveal DetailHide Detail
      static int WINDOW_LAST
      The last number in the range of ids used for window events.
      public static final int WINDOW_LAST
      The last number in the range of ids used for window events.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_LOST_FOCUS Reveal DetailHide Detail
      static int WINDOW_LOST_FOCUS
      The window-lost-focus event type.
      public static final int WINDOW_LOST_FOCUS
      The window-lost-focus event type. This event is delivered when a Window is no longer the focused Window, which means keyboard events will no longer be delivered to the Window or any of its subcomponents.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_OPENED Reveal DetailHide Detail
      static int WINDOW_OPENED
      The window opened event.
      public static final int WINDOW_OPENED
      The window opened event. This event is delivered only the first time a window is made visible.
      See Also:
      Constant Field Values
      Ordinary member indicator WINDOW_STATE_CHANGED Reveal DetailHide Detail
      static int WINDOW_STATE_CHANGED
      The window-state-changed event type.
      public static final int WINDOW_STATE_CHANGED
      The window-state-changed event type. This event is delivered when a Window's state is changed by virtue of it being iconified, maximized etc.
      Since:
      1.4
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_STATE_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_STATE_EVENT_MASK
      The event mask for selecting window state events.
      public static final long WINDOW_STATE_EVENT_MASK
      The event mask for selecting window state events.
      Since:
      1.4
      See Also:
      Constant Field Values
    • Constructors 
      Constructor and Description
      Ordinary member indicator WindowEvent Reveal DetailHide Detail
      WindowEvent(Window source, int id)
      Constructs a WindowEvent object.
      public WindowEvent(Window source, int id)
      Constructs a WindowEvent object.

      This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - The Window object that originated the event
      id - An integer indicating the type of event. For information on allowable values, see the class description for WindowEvent.
      Throws:
      java.lang.IllegalArgumentException - if source is null
      See Also:
      getWindow(), AWTEvent.getID()
      Ordinary member indicator WindowEvent Reveal DetailHide Detail
      WindowEvent(Window source, int id, int oldState, int newState)
      Constructs a WindowEvent object with the specified previous and new window states.
      public WindowEvent(Window source, int id, int oldState, int newState)
      Constructs a WindowEvent object with the specified previous and new window states.

      This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - The Window object that originated the event
      id - An integer indicating the type of event. For information on allowable values, see the class description for WindowEvent. It is expected that this constructor will not be used for other then WINDOW_STATE_CHANGED WindowEvent types, because the previous and new window states are meaningless for other event types.
      oldState - An integer representing the previous window state. See #getOldState() for allowable values
      newState - An integer representing the new window state. See #getNewState() for allowable values
      Throws:
      java.lang.IllegalArgumentException - if source is null
      Since:
      1.4
      See Also:
      getWindow(), AWTEvent.getID(), getOldState(), getNewState()
      Ordinary member indicator WindowEvent Reveal DetailHide Detail
      WindowEvent(Window source, int id, Window opposite)
      Constructs a WindowEvent object with the specified opposite Window.
      public WindowEvent(Window source, int id, Window opposite)
      Constructs a WindowEvent object with the specified opposite Window. The opposite Window is the other Window involved in this focus or activation change. For a WINDOW_ACTIVATED or WINDOW_GAINED_FOCUS event, this is the Window that lost activation or focus. For a WINDOW_DEACTIVATED or WINDOW_LOST_FOCUS event, this is the Window that gained activation or focus. If this focus change occurs with a native application, with a Java application in a different VM, or with no other Window, then the opposite Window is null.

      This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - The Window object that originated the event
      id - An integer indicating the type of event. For information on allowable values, see the class description for WindowEvent. It is expected that this constructor will not be used for other then WINDOW_ACTIVATED,WINDOW_DEACTIVATED, WINDOW_GAINED_FOCUS, or WINDOW_LOST_FOCUS. WindowEvent types, because the opposite Window of other event types will always be null.
      opposite - The other Window involved in the focus or activation change, or null
      Throws:
      java.lang.IllegalArgumentException - if source is null
      Since:
      1.4
      See Also:
      getWindow(), AWTEvent.getID(), getOppositeWindow()
      Ordinary member indicator WindowEvent Reveal DetailHide Detail
      WindowEvent(Window source, int id, Window opposite, int oldState, int newState)
      Constructs a WindowEvent object.
      public WindowEvent(Window source, int id, Window opposite, int oldState, int newState)
      Constructs a WindowEvent object.

      This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - The Window object that originated the event
      id - An integer indicating the type of event. For information on allowable values, see the class description for WindowEvent
      opposite - The other window involved in the focus or activation change, or null
      oldState - Previous state of the window for window state change event. See #getOldState() for allowable values
      newState - New state of the window for window state change event. See #getNewState() for allowable values
      Throws:
      java.lang.IllegalArgumentException - if source is null
      Since:
      1.4
      See Also:
      getWindow(), AWTEvent.getID(), getOppositeWindow(), getOldState(), getNewState()
    • Methods 
      Modifier and Type Method and Description
      Inherited member indicator consume Reveal DetailHide Detail
      protected void consume()
      Consumes this event, if this event can be consumed.
      protected void consume()
      Description copied from class: AWTEvent
      Consumes this event, if this event can be consumed. Only low-level, system events can be consumed
      Inherited member indicator getComponent Reveal DetailHide Detail
      Component getComponent()
      Returns the originator of the event.
      public Component getComponent()
      Description copied from class: ComponentEvent
      Returns the originator of the event.
      Returns:
      the Component object that originated the event, or null if the object is not a Component.
      Inherited member indicator getID Reveal DetailHide Detail
      int getID()
      Returns the event type.
      public int getID()
      Description copied from class: AWTEvent
      Returns the event type.
      Ordinary member indicator getNewState Reveal DetailHide Detail
      int getNewState()
      For WINDOW_STATE_CHANGED events returns the new state of the window.
      public int getNewState()
      For WINDOW_STATE_CHANGED events returns the new state of the window. The state is represented as a bitwise mask.
      • NORMAL
        Indicates that no state bits are set.
      • ICONIFIED
      • MAXIMIZED_HORIZ
      • MAXIMIZED_VERT
      • MAXIMIZED_BOTH
        Concatenates MAXIMIZED_HORIZ and MAXIMIZED_VERT.
      Returns:
      a bitwise mask of the new window state
      Since:
      1.4
      See Also:
      Frame.getExtendedState()
      Ordinary member indicator getOldState Reveal DetailHide Detail
      int getOldState()
      For WINDOW_STATE_CHANGED events returns the previous state of the window.
      public int getOldState()
      For WINDOW_STATE_CHANGED events returns the previous state of the window. The state is represented as a bitwise mask.
      • NORMAL
        Indicates that no state bits are set.
      • ICONIFIED
      • MAXIMIZED_HORIZ
      • MAXIMIZED_VERT
      • MAXIMIZED_BOTH
        Concatenates MAXIMIZED_HORIZ and MAXIMIZED_VERT.
      Returns:
      a bitwise mask of the previous window state
      Since:
      1.4
      See Also:
      Frame.getExtendedState()
      Ordinary member indicator getOppositeWindow Reveal DetailHide Detail
      Window getOppositeWindow()
      Returns the other Window involved in this focus or activation change.
      public Window getOppositeWindow()
      Returns the other Window involved in this focus or activation change. For a WINDOW_ACTIVATED or WINDOW_GAINED_FOCUS event, this is the Window that lost activation or focus. For a WINDOW_DEACTIVATED or WINDOW_LOST_FOCUS event, this is the Window that gained activation or focus. For any other type of WindowEvent, or if the focus or activation change occurs with a native application, with a Java application in a different VM or context, or with no other Window, null is returned.
      Returns:
      the other Window involved in the focus or activation change, or null
      Since:
      1.4
      Inherited member indicator getSource Reveal DetailHide Detail
      java.lang.Object getSource()
      The object on which the Event initially occurred.
      public java.lang.Object getSource()
      Description copied from class: java.util.EventObject
      The object on which the Event initially occurred.
      Returns:
      The object on which the Event initially occurred.
      Ordinary member indicator getWindow Reveal DetailHide Detail
      Window getWindow()
      Returns the originator of the event.
      public Window getWindow()
      Returns the originator of the event.
      Returns:
      the Window object that originated the event
      Inherited member indicator isConsumed Reveal DetailHide Detail
      protected boolean isConsumed()
      Returns whether this event has been consumed.
      protected boolean isConsumed()
      Description copied from class: AWTEvent
      Returns whether this event has been consumed.
      Overridden member indicator paramString Reveal DetailHide Detail
      java.lang.String paramString()
      Returns a parameter string identifying this event.
      public java.lang.String paramString()
      Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.
      Overrides:
      paramString in class ComponentEvent
      Returns:
      a string identifying the event and its attributes
      Inherited member indicator setSource Reveal DetailHide Detail
      void setSource(java.lang.Object newSource)
      Retargets an event to a new source.
      public void setSource(java.lang.Object newSource)
      Description copied from class: AWTEvent
      Retargets an event to a new source. This method is typically used to retarget an event to a lightweight child Component of the original heavyweight source.

      This method is intended to be used only by event targeting subsystems, such as client-defined KeyboardFocusManagers. It is not for general client use.

      Parameters:
      newSource - the new Object to which the event should be dispatched
      Since:
      1.4
      Inherited member indicator toString Reveal DetailHide Detail
      java.lang.String toString()
      Returns a String representation of this object.
      public java.lang.String toString()
      Description copied from class: AWTEvent
      Returns a String representation of this object.
      Overrides:
      toString in class java.util.EventObject
      Returns:
      A a String representation of this EventObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge