Monday, 3 February 2014

Event classes:The ComponentEvent Class

ComponentEvent:is the superclass either directly or indirectly of ContainerEvent,FocusEvent, KeyEvent,MouseEvent, and WindowEvent.

The ComponentEvent Class


A ComponentEvent is generated when the size, position, or visibility of a component is changed.The ComponentEvent class defines integer constants that can be used to identify them. ComponentEvent is the superclass either directly or indirectly of ContainerEvent,FocusEvent, KeyEvent,MouseEvent, and WindowEvent.

component events:

  • COMPONENT_HIDDEN :The component was hidden.
  • COMPONENT_MOVED : The component was moved.
  • COMPONENT_RESIZED: The component was resized.
  • COMPONENT_SHOWN :The component became visible.

 ComponentEvent  Consructor:


       ComponentEvent(Componentsrc, int type)

                Here,src is a reference to the object that generated this event. The type of the event is specified by type.


Methods  in ComponentEvent:


 getComponent( ) method :

           The getComponent( ) method returns the component that generated the event. It is shown here:

        Component getComponent( )

No comments :

Post a Comment