Showing posts with label Event classes. Show all posts
Showing posts with label Event classes. Show all posts

Monday, 24 February 2014

EVENT CLASSES:MouseEvent Class

 KeyEvent and MouseEvent are subclasses of abstract InputEvent class..................

The MouseEvent Class

                    KeyEvent and MouseEvent are subclasses of abstract InputEvent class. Both these events are generated by objects of type Component class and its subclasses.The MouseEvent is generated when the user presses the mouse or moves the mouse.


The MouseEvent class defines the following integer constants:


  • MOUSE_CLICKED    :     The user clicked the mouse.
  • MOUSE_DRAGGED  :     The user dragged the mouse.
  • MOUSE_ENTERED   :     The mouse entered a component.
  • MOUSE_EXITED        :     The mouse exited from a component.
  • MOUSE_MOVED        :     The mouse moved.
  • MOUSE_PRESSED   :     The mouse was pressed.
  • MOUSE_RELEASED:    The mouse was released.
  • MOUSE_WHEEL        :    The mouse wheel was moved.


 MouseEvent constructors:


MouseEvent(Componentsrc, int type, long when, int modifiers,int x, int y, int clicks, boolean triggersPopup)

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

Saturday, 1 February 2014

Event Classes:The AdjustmentEvent Class

AdjustmentEvent:BLOCK-DECREMENT,TRACK,INTEGER CONSTANT

The AdjustmentEvent Class

An AdjustmentEvent is generated by a scroll bar.

Adjustment events.


  • BLOCK_DECREMENT :

             The user clicked inside the scroll bar to decrease its value.

  • BLOCK_INCREMENT:

            The user clicked inside the scroll bar to increase its value.

  • TRACK:

         The slider was dragged.

  • UNIT_DECREMENT :

        The button at the end of the scroll bar was clicked to decrease its value.

  • UNIT_INCREMENT :

         The button at the end of the scroll bar was clicked to increase its value.