Tuesday, 25 February 2014

EVENT CLASSES:WindowEvent Class

WindowEvent is a subclass of ComponentEvent.....................

The WindowEvent Class


              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.

TheWindowEvent class: integer constants


  • WINDOW_ACTIVATED           : The window was activated.
  • WINDOW_CLOSED                 :The window has been closed.
  • WINDOW_CLOSING                 : The user requested that the window be closed.
  • WINDOW_DEACTIVATED       :The window was deactivated.
  • WINDOW_DEICONIFIED          :The window was deiconified.
  • WINDOW_GAINED_FOCUS    :The window gained input focus.
  • WINDOW_ICONIFIED                :The window was iconified.
  • WINDOW_LOST_FOCUS         :The window lost input focus.
  • WINDOW_OPENED                   :The window was opened.
  • WINDOW_STATE_CHANGED :The state of the window changed.

 

WindowEvent:- constructors. 


  • WindowEvent(Window src, int type)
  • WindowEvent(Window src, int type, Window other)
  • WindowEvent(Window src, int type, int fromState, int toState)
  • WindowEvent(Window src, int type, Window other, int fromState, int toState)

         Here,src is a reference to the object that generated this event. other specifies the
opposite window when a focus or activation event occurs. The fromState specifies the prior state of the window, and toState specifies the new state that the window will have when a window state change occurs.


 WindowEvent:- methods


  •  getWindow( ) method: 

               It returns the Window object that generated the event. 
 syntax:
             Window getWindow( )

  •  getOppositeWindow( ),getOldState( ) & getNewState( ):

           WindowEvent also defines methods that return the opposite window (when a focus or activation event has occurred), the previous window state, and the current window state.

syntax:

  Window getOppositeWindow( )
   int getOldState( )
   int getNewState( )

No comments :

Post a Comment