java.awt.event
Class InputEvent
java.lang.Object
|
+--java.util.EventObject
|
+--java.awt.AWTEvent
|
+--java.awt.event.ComponentEvent
|
+--java.awt.event.InputEvent
This is the common superclass for all component input classes. These are
passed to listeners before the component, so that listeners can consume
the event before it does its default behavior.
Since:Author:- Aaron M. Renn <arenn@urbanophile.com>
See Also:
ALT_DOWN_MASK
public static final int ALT_DOWN_MASK
The ALT key extended modifier.
Since:
ALT_GRAPH_DOWN_MASK
public static final int ALT_GRAPH_DOWN_MASK
The ALT_GRAPH key extended modifier.
Since:
ALT_GRAPH_MASK
public static final int ALT_GRAPH_MASK
This is the bit mask which indicates the alt-graph modifier is in effect.
It is recommended that ALT_GRAPH_DOWN_MASK be used instead.
See Also:
ALT_MASK
public static final int ALT_MASK
This is the bit mask which indicates the alt key is down. It is
recommended that ALT_DOWN_MASK be used instead.
See Also:
BUTTON1_DOWN_MASK
public static final int BUTTON1_DOWN_MASK
The mouse button1 key extended modifier.
Since:
BUTTON1_MASK
public static final int BUTTON1_MASK
This bit mask indicates mouse button one is down. It is recommended that
BUTTON1_DOWN_MASK be used instead.
See Also:
BUTTON2_DOWN_MASK
public static final int BUTTON2_DOWN_MASK
The mouse button2 extended modifier.
Since:
BUTTON2_MASK
public static final int BUTTON2_MASK
This bit mask indicates mouse button two is down. It is recommended that
BUTTON2_DOWN_MASK be used instead.
See Also:
BUTTON3_DOWN_MASK
public static final int BUTTON3_DOWN_MASK
The mouse button3 extended modifier.
Since:
BUTTON3_MASK
public static final int BUTTON3_MASK
This bit mask indicates mouse button three is down. It is recommended
that BUTTON3_DOWN_MASK be used instead.
See Also:
CTRL_DOWN_MASK
public static final int CTRL_DOWN_MASK
The CTRL key extended modifier.
Since:
CTRL_MASK
public static final int CTRL_MASK
This is the bit mask which indicates the control key is down. It is
recommended that CTRL_DOWN_MASK be used instead.
See Also:
META_DOWN_MASK
public static final int META_DOWN_MASK
The META key extended modifier.
Since:
META_MASK
public static final int META_MASK
This is the bit mask which indicates the meta key is down. It is
recommended that META_DOWN_MASK be used instead.
See Also:
SHIFT_DOWN_MASK
public static final int SHIFT_DOWN_MASK
The SHIFT key extended modifier.
Since:
SHIFT_MASK
public static final int SHIFT_MASK
This is the bit mask which indicates the shift key is down. It is
recommended that SHIFT_DOWN_MASK be used instead.
See Also:
consume
public void consume()
Consumes this event. A consumed event is not processed further by the AWT
system.
getModifiers
public int getModifiers()
This method returns the old-style modifiers in effect for this event.
Note that this is ambiguous between button2 and alt, and between
button3 and meta. Also, code which generated these modifiers tends to
only list the modifier that just changed, even if others were down at
the time. Consider using getModifiersEx instead. This will be a union
of the bit masks defined in this class that are applicable to the event.
Returns:
- the modifiers in effect for this event
See Also:
getModifiersEx
public int getModifiersEx()
Returns the extended modifiers (new-style) for this event. This represents
the state of all modal keys and mouse buttons at the time of the event,
and does not suffer from the problems mentioned in getModifiers.
For an example of checking multiple modifiers, this code will return
true only if SHIFT and BUTTON1 were pressed and CTRL was not:
int onmask = InputEvent.SHIFT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK;
int offmask = InputEvent.CTRL_DOWN_MASK;
return (event.getModifiersEx() & (onmask | offmask)) == onmask;
Since:Returns:
- the bitwise or of all modifiers pressed during the event
getModifiersExText
public static String getModifiersExText(int modifiers)
Convert the extended modifier bitmask into a String, such as "Shift" or
"Ctrl+Button1".
XXX Sun claims this can be localized via the awt.properties file - how
do we implement that?
Since:Parameters:
Returns:
- a string representation of the modifiers in this bitmask
getWhen
public long getWhen()
This method returns the timestamp when this event occurred.
Returns:
- the timestamp when this event occurred
isAltDown
public boolean isAltDown()
This method tests whether or not the alt key was down during the event.
Returns:
- true if the alt key is down
isAltGraphDown
public boolean isAltGraphDown()
This method tests whether or not the alt-graph modifier was in effect
during the event.
Returns:
- true if the alt-graph modifier is down
isConsumed
public boolean isConsumed()
This method tests whether or not this event has been consumed.
Returns:
- true if this event has been consumed
isControlDown
public boolean isControlDown()
This method tests whether or not the control key was down during the
event.
Returns:
- true if the control key is down
isMetaDown
public boolean isMetaDown()
This method tests whether or not the meta key was down during the event.
Returns:
- true if the meta key is down
isShiftDown
public boolean isShiftDown()
This method tests whether or not the shift key was down during the event.
Returns:
- true if the shift key is down