java.awt.event
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Modifier and Type | Field and Description |
|---|---|
static int |
ACTION_FIRST
The first number in the range of ids used for action events. |
static int |
ACTION_LAST
The last number in the range of ids used for action events. |
static int |
ACTION_PERFORMED
This event id indicates that a meaningful action occured. |
static int |
ALT_MASK
The alt modifier. |
static int |
CTRL_MASK
The control modifier. |
static int |
META_MASK
The meta modifier. |
static int |
SHIFT_MASK
The shift modifier. |
| Fields inherited from class java.util.EventObject |
|---|
source |
| Constructor and Description |
|---|
ActionEvent(Object source,
int id,
String command)
Constructs an ActionEvent object. |
ActionEvent(Object source,
int id,
String command,
int modifiers)
Constructs an ActionEvent object with modifier keys. |
ActionEvent(Object source,
int id,
String command,
long when,
int modifiers)
Constructs an ActionEvent object with the specified
modifier keys and timestamp. |
| Modifier and Type | Method and Description |
|---|---|
String |
getActionCommand()
Returns the command string associated with this action. |
int |
getModifiers()
Returns the modifier keys held down during this action event. |
long |
getWhen()
Returns the timestamp of when this event occurred. |
String |
paramString()
Returns a parameter string identifying this action event. |
| Methods inherited from class java.awt.AWTEvent |
|---|
consume, getID, isConsumed, setSource, toString |
| Methods inherited from class java.util.EventObject |
|---|
getSource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
SHIFT_MASK
public static final int SHIFT_MASK
- The shift modifier. An indicator that the shift key was held
down during the event.
- See Also:
- Constant Field Values
CTRL_MASK
public static final int CTRL_MASK
- The control modifier. An indicator that the control key was held
down during the event.
- See Also:
- Constant Field Values
META_MASK
public static final int META_MASK
- The meta modifier. An indicator that the meta key was held
down during the event.
- See Also:
- Constant Field Values
ALT_MASK
public static final int ALT_MASK
- The alt modifier. An indicator that the alt key was held
down during the event.
- See Also:
- Constant Field Values
ACTION_FIRST
public static final int ACTION_FIRST
- The first number in the range of ids used for action events.
- See Also:
- Constant Field Values
ACTION_LAST
public static final int ACTION_LAST
- The last number in the range of ids used for action events.
- See Also:
- Constant Field Values
ACTION_PERFORMED
public static final int ACTION_PERFORMED
- This event id indicates that a meaningful action occured.
- See Also:
- Constant Field Values
| Constructor Detail |
|---|
ActionEvent
public ActionEvent(Object source, int id, String command)
- Constructs an
ActionEventobject.This method throws an
IllegalArgumentExceptionifsourceisnull. Anullcommandstring is legal, but not recommended. - Parameters:
source- The object that originated the eventid- An integer that identifies the event. For information on allowable values, see the class description forActionEventcommand- A string that may specify a command (possibly one of several) associated with the event- Throws:
IllegalArgumentException- ifsourceis null- See Also:
EventObject.getSource(),AWTEvent.getID(),getActionCommand()
ActionEvent
public ActionEvent(Object source, int id, String command, int modifiers)
- Constructs an
ActionEventobject with modifier keys.This method throws an
IllegalArgumentExceptionifsourceisnull. Anullcommandstring is legal, but not recommended. - Parameters:
source- The object that originated the eventid- An integer that identifies the event. For information on allowable values, see the class description forActionEventcommand- A string that may specify a command (possibly one of several) associated with the eventmodifiers- The modifier keys down during event (shift, ctrl, alt, meta). Passing negative parameter is not recommended. Zero value means that no modifiers were passed- Throws:
IllegalArgumentException- ifsourceis null- See Also:
EventObject.getSource(),AWTEvent.getID(),getActionCommand(),getModifiers()
ActionEvent
public ActionEvent(Object source, int id, String command, long when, int modifiers)
- Constructs an
ActionEventobject with the specified modifier keys and timestamp.This method throws an
IllegalArgumentExceptionifsourceisnull. Anullcommandstring is legal, but not recommended. - Parameters:
source- The object that originated the eventid- An integer that identifies the event. For information on allowable values, see the class description forActionEventcommand- A string that may specify a command (possibly one of several) associated with the eventmodifiers- The modifier keys down during event (shift, ctrl, alt, meta). Passing negative parameter is not recommended. Zero value means that no modifiers were passedwhen- A long that gives the time the event occurred. Passing negative or zero value is not recommended- Throws:
IllegalArgumentException- ifsourceis null- Since:
- 1.4
- See Also:
EventObject.getSource(),AWTEvent.getID(),getActionCommand(),getModifiers(),getWhen()
| Method Detail |
|---|
getActionCommand
public String getActionCommand()
- Returns the command string associated with this action.
This string allows a "modal" component to specify one of several
commands, depending on its state. For example, a single button might
toggle between "show details" and "hide details". The source object
and the event would be the same in each case, but the command string
would identify the intended action.
Note that if a
nullcommand string was passed to the constructor for thisActionEvent, this this method returnsnull. - Returns:
- the string identifying the command for this event
getWhen
public long getWhen()
- Returns the timestamp of when this event occurred. Because an
ActionEvent is a high-level, semantic event, the timestamp is typically
the same as an underlying InputEvent.
- Returns:
- this event's timestamp
- Since:
- 1.4
getModifiers
public int getModifiers()
- Returns the modifier keys held down during this action event.
- Returns:
- the bitwise-or of the modifier constants
paramString
public String paramString()
- Returns a parameter string identifying this action event.
This method is useful for event-logging and for debugging.
- Overrides:
paramStringin classAWTEvent
- Returns:
- a string identifying the event and its associated command
|
Java™ Platform Standard Ed. 7 DRAFT ea-b59 |
|||||||||
| PREV CLASS NEXT CLASS | NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
