AWT WindowEvent Class

  • Post author:
  • Post category:AWT
  • Post comments:2 Comments
WindowEvent Class

The object of this class represents the change in the state of a WindowEvent Class. This low-level event is generated by a Window object when it is opened, closed, activated, deactivated, iconified, or deiconified, or when the focus is transferred 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
1WindowEvent(Window source, int id)Constructs a WindowEvent object.
2WindowEvent(Window source, int id, int oldState, int newState)Constructs a WindowEvent object with the specified previous and new window states.
3WindowEvent(Window source, int id, Window opposite)Constructs a WindowEvent object with the specified opposite Window.
4WindowEvent(Window source, int id, Window opposite, int oldState, int newState)Constructs a WindowEvent object.

Class methods

S.N.Method & Description
1int getNewState()For WINDOW_STATE_CHANGED events returns the new state of the window.
2int getOldState()For WINDOW_STATE_CHANGED events returns the previous state of the window.
3Window getOppositeWindow()Returns the other Window involved in this focus or activation change.
4Window getWindow()Returns the originator of the event.
5String 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

Previous Page:-Click Here

This Post Has 2 Comments

Leave a Reply