public class ActionEvent extends AWTEvent
ActionListener
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
ACTION_FIRST
The first id number in the range of action id's.
|
static int |
ACTION_LAST
The last id number in the range of action id's.
|
static int |
ACTION_PERFORMED
An event id indicating that an action has occurred.
|
static int |
ALT_MASK
Bit mask indicating that the alt key was pressed.
|
static int |
CTRL_MASK
Bit mask indicating the control key was pressed.
|
static int |
META_MASK
Bit mask indicating the that meta key was pressed.
|
static int |
SHIFT_MASK
Bit mask indicating the shift key was pressed.
|
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK
source
Constructor and Description |
---|
ActionEvent(Object source,
int id,
String command)
Initializes a new instance of
ActionEvent with the
specified source, id, and command. |
ActionEvent(Object source,
int id,
String command,
int modifiers)
Initializes a new instance of
ActionEvent with the
specified source, id, command, and modifiers. |
ActionEvent(Object source,
int id,
String command,
long when,
int modifiers)
Initializes a new instance of
ActionEvent with the
specified source, id, command, and modifiers, and timestamp. |
Modifier and Type | Method and Description |
---|---|
String |
getActionCommand()
Returns the command string associated with this action.
|
int |
getModifiers()
Returns the keys held down during the action.
|
long |
getWhen()
Gets the timestamp of when this action took place.
|
String |
paramString()
Returns a string that identifies the action event.
|
getSource
public static final int SHIFT_MASK
public static final int CTRL_MASK
public static final int META_MASK
public static final int ALT_MASK
public static final int ACTION_FIRST
public static final int ACTION_LAST
public static final int ACTION_PERFORMED
public ActionEvent(Object source, int id, String command)
ActionEvent
with the
specified source, id, and command. Note that an invalid id leads to
unspecified results.source
- the event sourceid
- the event idcommand
- the command string for this actionIllegalArgumentException
- if source is nullpublic ActionEvent(Object source, int id, String command, int modifiers)
ActionEvent
with the
specified source, id, command, and modifiers. Note that an invalid id
leads to unspecified results.source
- the event sourceid
- the event idcommand
- the command string for this actionmodifiers
- the bitwise or of modifier keys down during the actionIllegalArgumentException
- if source is nullpublic ActionEvent(Object source, int id, String command, long when, int modifiers)
ActionEvent
with the
specified source, id, command, and modifiers, and timestamp. Note that
an invalid id leads to unspecified results.source
- the event sourceid
- the event idcommand
- the command string for this actionwhen
- the timestamp of the eventmodifiers
- the bitwise or of modifier keys down during the actionIllegalArgumentException
- if source is nullpublic String getActionCommand()
public long getWhen()
public int getModifiers()
public String paramString()
"ACTION_PERFORMED,cmd=" + getActionCommand() + ",when=" + getWhen()
+ ",modifiers=" + <modifier string>
, where the modifier
string is in the order "Meta", "Ctrl", "Alt", "Shift", "Alt Graph", and
"Button1", separated by '+', according to the bits set in getModifiers().paramString
in class AWTEvent