Wednesday, 5 February 2014

Event classes:The FocusEvent Class

 FocusEvent :gains or loses input focus.......

The FocusEvent Class


         A FocusEvent is generated when a component gains or loses input focus. 


Integer constants :

  • FOCUS_GAINED 
  • FOCUS_LOST

 FocusEvent Constructor:

FocusEvent is a subclass of ComponentEvent and has these constructors:


  • FocusEvent(Componentsrc, int type)
  • FocusEvent(Componentsrc, int type, boolean temporaryFlag)
  • FocusEvent(Componentsrc, int type, boolean temporaryFlag, Component other)

Event classes:The ContainerEvent Class

 ContainerEvent:added to or removed from a container.

The ContainerEvent Class


A ContainerEvent is generated when a component is added to or removed from a container.


 container events:


  •  COMPONENT_ADDED 
  •  COMPONENT_REMOVED

They indicate that a component has been added to or removed from the container.
ContainerEvent is a subclass of ComponentEvent and has this constructor:

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.

Event Classes in java

The classes that represent events are at the core of Java’s event handling mechanism......

Event Classes

The classes that represent events are at the core of Java’s event handling mechanism. At the root of the Java event class hierarchy is EventObject, which is in java.util. EventObject contains two methods: getSource( ) and toString( ). 

The getSource( )method returns the source of the event. Its general form is shown here:

        Object getSource( )

As expected, toString( )returns the string equivalent of the event.The class AWTEvent, defined within the java.awt package, is a subclass of EventObject.It is the superclass (either directly or indirectly) of all AWT-based events used by the delegation event model. Its getID()method can be used to determine the type of the event. 

The signature of this method is shown here:

         int getID()

EVENT CLASSES:The InputEvent Class

The abstract class InputEvent is a subclass of ComponentEvent...........

The InputEvent Class

The abstract class InputEvent is a subclass of ComponentEvent and is the superclass for component input events. Its subclasses are KeyEvent andMouseEvent.InputEvent defines several integer constants that represent any modifiers, such as the control key being pressed, that might be associated with the event.

The InputEvent class defined the following eight values to represent the modifiers:

ALT_MASK 
ALT_GRAPH_MASK 
BUTTON2_MASK 
BUTTON3_MASK 
BUTTON1_MASK 
CTRL_MASK
META_MASK
SHIFT_MASK