SWING - InputEvent Class
The InputEvent class is root event class for all component-level input events. Input events are delivered to listeners before they are processed normally by the source where they originated. This allows listeners and component subclasses to "consume" the event so that the source will not process them in their default manner. For example, consuming mousePressed events on a Button component will prevent the Button from being activated.
Class declaration
Following is the declaration for java.awt.event.InputEvent class:
public abstract class InputEvent extends ComponentEvent
Field
Following are the fields for java.awt.event.InputEvent class:
static int ALT_DOWN_MASK -- The Alt key extended modifier constant.
static int ALT_GRAPH_DOWN_MASK -- The AltGraph key extended modifier constant.
static int ALT_GRAPH_MASK -- The AltGraph key modifier constant.
static int ALT_MASK -- The Alt key modifier constant.
static int BUTTON1_DOWN_MASK -- The Mouse Button1 extended modifier constant.
static int BUTTON1_MASK -- The Mouse Button1 modifier constant.
static int BUTTON2_DOWN_MASK -- The Mouse Button2 extended modifier constant.
static int BUTTON2_MASK -- The Mouse Button2 modifier constant.
static int BUTTON3_DOWN_MASK -- The Mouse Button3 extended modifier constant.
static int BUTTON3_MASK --The Mouse Button3 modifier constant.
static int CTRL_DOWN_MASK -- The Control key extended modifier constant.
static int CTRL_MASK -- The Control key modifier constant.
static int META_DOWN_MASK -- The Meta key extended modifier constant.
static int META_MASK -- The Meta key modifier constant.
static int SHIFT_DOWN_MASK -- The Shift key extended modifier constant.
static int SHIFT_MASK -- The Shift key modifier constant.
Class methods
S.N. | Method & Description |
---|---|
1 | void consume() Consumes this event so that it will not be processed in the default manner by the source which originated it. |
2 | int getModifiers() Returns the modifier mask for this event. |
3 | int getModifiersEx() Returns the extended modifier mask for this event. |
4 | static String getModifiersExText(int modifiers) Returns a String describing the extended modifier keys and mouse buttons, such as "Shift", "Button1", or "Ctrl+Shift". |
5 | long getWhen() Returns the timestamp of when this event occurred. |
6 | boolean isAltDown() Returns whether or not the Alt modifier is down on this event. |
7 | boolean isAltGraphDown() Returns whether or not the AltGraph modifier is down on this event. |
8 | boolean isConsumed()Returns whether or not this event has been consumed. |
9 | boolean isControlDown() Returns whether or not the Control modifier is down on this event. |
10 | boolean isMetaDown() Returns whether or not the Meta modifier is down on this event. |
11 | boolean isShiftDown() Returns whether or not the Shift modifier is down on this event. |
Methods inherited
This class inherits methods from the following classes:
java.awt.event.ComponentEvent
java.awt.AWTEvent
java.util.EventObject
java.lang.Object