SWING: WindowEvent Class Cheat Sheet

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

public class WindowEvent
   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 the 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 iconified 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 the event.
  • static int WINDOW_STATE_CHANGED − The window-state-changed event type.
# Constructors
WindowEvent(Window source, int id)Constructs a WindowEvent object.
WindowEvent(Window source, int id, int oldState, int newState)Constructs a WindowEvent object with the specified previous and new window states.
WindowEvent(Window source, int id, Window opposite)Constructs a WindowEvent object with the specified opposite Window.
WindowEvent(Window source, int id, Window opposite, int oldState, int newState)Constructs a WindowEvent object.
# Methods
int getNewState()For WINDOW_STATE_CHANGED events returns the new state of the window.
int getOldState()For WINDOW_STATE_CHANGED events returns the previous state of the window.
Window getOppositeWindow()Returns the other Window involved in this focus or activation change.
Window getWindow()Returns the originator of the event.
String paramString()Returns a parameter string identifying this event.
# Methods Inherited
  • java.awt.event.ComponentEvent
  • java.awt.AWTEvent
  • java.util.EventObject
  • java.lang.Object

Leave a Reply

Your email address will not be published. Required fields are marked *