java.awt.event
Class ActionEvent
java.lang.Object
|
+--java.util.EventObject
|
+--java.awt.AWTEvent
|
+--java.awt.event.ActionEvent
public class
ActionEventextends
AWTEvent This event is generated when an action on a component (such as a
button press) occurs.
Since:Author:- Aaron M. Renn <arenn@urbanophile.com>
See Also:
ACTION_FIRST
public static final int ACTION_FIRST
The first id number in the range of action id's.
ACTION_LAST
public static final int ACTION_LAST
The last id number in the range of action id's.
ACTION_PERFORMED
public static final int ACTION_PERFORMED
An event id indicating that an action has occurred.
ALT_MASK
public static final int ALT_MASK
Bit mask indicating that the alt key was pressed.
CTRL_MASK
public static final int CTRL_MASK
Bit mask indicating the control key was pressed.
META_MASK
public static final int META_MASK
Bit mask indicating the that meta key was pressed.
SHIFT_MASK
public static final int SHIFT_MASK
Bit mask indicating the shift key was pressed.
ActionEvent
public ActionEvent(java.lang.Object source, int id, java.lang.String command)
Initializes a new instance of ActionEvent
with the
specified source, id, and command. Note that an invalid id leads to
unspecified results.
Parameters:
Throws:
ActionEvent
public ActionEvent(java.lang.Object source, int id, java.lang.String command, int modifiers)
Initializes a new instance of ActionEvent
with the
specified source, id, command, and modifiers. Note that an invalid id
leads to unspecified results.
Parameters:
Throws:
ActionEvent
public ActionEvent(java.lang.Object source, int id, java.lang.String command, long when, int modifiers)
Initializes a new instance of ActionEvent
with the
specified source, id, command, and modifiers, and timestamp. Note that
an invalid id leads to unspecified results.
Since:Parameters:
Throws:
getActionCommand
public String getActionCommand()
Returns the command string associated with this action.
Returns:
- the command string associated with this action
getModifiers
public int getModifiers()
Returns the keys held down during the action. This value will be a
combination of the bit mask constants defined in this class, or 0 if no
modifiers were pressed.
Returns:
getWhen
public long getWhen()
Gets the timestamp of when this action took place. Usually, this
corresponds to the timestamp of the underlying InputEvent.
Since:Returns:
- the timestamp of this action
paramString
public String paramString()
Returns a string that identifies the action event. This is in the format
"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().
Returns:
- a string identifying the event