public class ActionEvent extends Object
ActionListener
callback is invokedConstructor and Description |
---|
ActionEvent(Command source,
Component sourceComponent,
int x,
int y)
Creates a new instance of ActionEvent for a command
|
ActionEvent(Component dragged,
Component drop,
int x,
int y)
Creates a new instance of ActionEvent for a drop operation
|
ActionEvent(Object source)
Creates a new instance of ActionEvent
|
ActionEvent(Object source,
int keyEvent)
Creates a new instance of ActionEvent
|
ActionEvent(Object source,
int keyEvent,
boolean longClick)
Creates a new instance of ActionEvent
|
ActionEvent(Object source,
int x,
int y)
Creates a new instance of ActionEvent as a pointer event
|
ActionEvent(Object source,
int x,
int y,
boolean longPointer)
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
|
Component |
getComponent()
Returns the source component object
|
Component |
getDraggedComponent()
Set in the case of a drop listener, returns the component being dragged
|
Component |
getDropTarget()
Set in the case of a drop listener, returns the component on which the drop occurs
|
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.
|
boolean |
isLongEvent()
Returns true for long click or long pointer event
|
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 keyEvent, boolean longClick)
source
- element for the action eventkeyEvent
- the key that triggered the eventlongClick
- true if the event is triggered from long pressedpublic ActionEvent(Object source, int x, int y, boolean longPointer)
source
- element for the pointer eventx
- the x position of the pointer eventy
- the y position of the pointer eventlongPointer
- true if the event is triggered from long pressedpublic 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 ActionEvent(Command source, Component sourceComponent, int x, int y)
source
- element commandsourceComponent
- the triggering componentx
- the x position of the pointer eventy
- the y position of the pointer eventpublic Object getSource()
public int getKeyEvent()
public Command getCommand()
public Component getComponent()
public void consume()
public boolean isConsumed()
public int getX()
public int getY()
public boolean isLongEvent()
public Component getDraggedComponent()
public Component getDropTarget()