public class ActionEvent extends Object
ActionListener
callback is invokedConstructor and Description |
---|
ActionEvent(Object source)
Creates a new instance of ActionEvent
|
ActionEvent(Object source,
int keyEvent)
Creates a new instance of ActionEvent
|
ActionEvent(Object source,
int x,
int y)
Creates a new instance of ActionEvent as a pointer event
|
Modifier and Type | Method and Description |
---|---|
void |
consume()
Consume the event indicating that it was handled thus preventing other action
listeners from handling/receiving the event
|
Command |
getCommand()
If this event was sent as a result of a command action this method returns
that command
|
int |
getKeyEvent()
If this event was triggered by a key press this method will return the
appropriate keycode
|
Object |
getSource()
The element that triggered the action event, useful for decoupling event
handling code
|
int |
getX()
The X position if this is a pointer event otherwise undefined
|
int |
getY()
The Y position if this is a pointer event otherwise undefined
|
boolean |
isConsumed()
Returns true if the event was consumed thus indicating that it was handled.
|
public ActionEvent(Object source)
source
- element for the action eventpublic ActionEvent(Object source, int keyEvent)
source
- element for the action eventkeyEvent
- the key that triggered the eventpublic ActionEvent(Object source, int x, int y)
source
- element for the pointer eventx
- the x position of the pointer eventy
- the y position of the pointer eventpublic Object getSource()
public int getKeyEvent()
public Command getCommand()
public void consume()
public boolean isConsumed()
public int getX()
public int getY()