In Java, an action event is a semantic event which indicates occurrence of an action generated by a component like a button. This action event then passes to its ActionListener object, which is done by calling addActionListener method of the component.
When a user performs an action event like a click event on a button in any java based application this click is transformed to an ActionEvent
that is generated and received by its ActionListener
object. ActionListener is a java interface which works as a receiver of action events.
The class that is interested in processing an action event should necessarily implement this interface, and the object created with that class is registered with a component, using the component's addActionListener
method. When the action event occurs, that object's actionPerformed
method is invoked whenever an action occurs.
The class ActionEvent is a public class which extends AWTEvent
class of java.
The action event like clicking of a button can also be performed using keyboard by pressing the space bar.
Class ActionEvent provides 3 predefined constructors:
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.
Usage:
The tag actionevent
can be used for programming problems related to GUI applications and event handling based problems in java. This tag should not be used for problems related to event handling in javascript and other languages.
Official documentation for class ActionEvent
can be found at http://docs.oracle.com/javase/7/docs/api/java/awt/event/ActionEvent.html