SWING - WindowEvent Class


Advertisements


The object of this class represents the change in state of a window.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.

Class declaration

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 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.

Class constructors

S.N. Constructor & Description
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.

Class methods

S.N. Method & Description
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.

Methods inherited

This class inherits methods from the following classes:

  • java.awt.event.ComponentEvent

  • java.awt.AWTEvent

  • java.util.EventObject

  • java.lang.Object


swing_event_classes.htm

Advertisements