SWING - ActionEvent Class


Advertisements


This class is defined in java.awt.event package. The ActionEvent is generated when button is clicked or the item of a list is double clicked.

Class declaration

Following is the declaration for java.awt.event.ActionEvent class:

public class ActionEvent
   extends AWTEvent

Field

Following are the fields for java.awt.event.ActionEvent class:

  • 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.

Class constructors

S.N. Constructor & Description
1 ActionEvent(java.lang.Object source, int id, java.lang.String command)

Constructs an ActionEvent object.

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

Constructs an ActionEvent object with modifier keys.

3 ActionEvent(java.lang.Object source, int id, java.lang.String command, long when, int modifiers)

Constructs an ActionEvent object with the specified modifier keys and timestamp.

Class methods

S.N. Method & Description
1 java.lang.String getActionCommand()

Returns the command string associated with this action.

2 int getModifiers()

Returns the modifier keys held down during this action event.

3 long getWhen()

Returns the timestamp of when this event occurred.

4 java.lang.String paramString()

Returns a parameter string identifying this action event.

Methods inherited

This class inherits methods from the following classes:

  • java.awt.AWTEvent

  • java.util.EventObject

  • java.lang.Object


swing_event_classes.htm

Advertisements