Monday, 3 February 2014

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


However, because of possible conflicts between the modifiers used by keyboard events and mouse events, and other issues, the following extended modifier values were added:

ALT_DOWN_MASK
ALT_GRAPH_DOWN_MASK 
BUTTON1_DOWN_MASK 
 BUTTON2_DOWN_MASK 
BUTTON3_DOWN_MASK 
CTRL_DOWN_MASK
META_DOWN_MASK
SHIFT_DOWN_MASK


Methods in InputEvent Class:


isAltDown( ),isAltGraphDown( ), isControlDown( ), isMetaDown( ), and isShiftDown( ) methods:
       To test if a modifier was pressed at the time an event is generated,use the isAltDown(),isAltGraphDown( ), isControlDown( ), isMetaDown( ), and isShiftDown( ) methods.

The form of this methods are shown here:

boolean isAltDown( )
boolean isAltGraphDown( )
boolean isControlDown( )
boolean isMetaDown( )
boolean isShiftDown( )

getModifiers( ) method:
                  You can obtain a value that contains all of the original modifier flags by calling the getModifiers() method. It is shown here:

int getModifiers( )

 getModifiersEx( ) method:
                  You can obtain the extended modifiers by calling getModifiersEx( ), which is shown here:

int getModifiersEx( )

No comments :

Post a Comment