Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt.event

Class ActionEvent

java.lang.Object
|
+--java.util.EventObject
   |
   +--java.awt.AWTEvent
      |
      +--java.awt.event.ActionEvent


public class ActionEvent

extends AWTEvent

This event is generated when an action on a component (such as a button press) occurs.

Since:Author:See Also:

Field Summary

static intACTION_FIRST

The first id number in the range of action id's.
static intACTION_LAST

The last id number in the range of action id's.
static intACTION_PERFORMED

An event id indicating that an action has occurred.
static intALT_MASK

Bit mask indicating that the alt key was pressed.
static intCTRL_MASK

Bit mask indicating the control key was pressed.
static intMETA_MASK

Bit mask indicating the that meta key was pressed.
static intSHIFT_MASK

Bit mask indicating the shift key was pressed.

Constructor Summary

ActionEvent(java.lang.Object source, int id, java.lang.String command)

Initializes a new instance of ActionEvent with the specified source, id, and command.
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.
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.

Method Summary

java.lang.StringgetActionCommand()

Returns the command string associated with this action.
intgetModifiers()

Returns the keys held down during the action.
longgetWhen()

Gets the timestamp of when this action took place.
java.lang.StringparamString()

Returns a string that identifies the action event.

Field Details

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.


Constructor Details

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:


Method Details

getActionCommand

public String getActionCommand()

Returns the command string associated with this action.

Returns:


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:


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: