java::awt::event::ActionEvent Class Reference

Inheritance diagram for java::awt::event::ActionEvent:

Inheritance graph
java::awt::AWTEventjava::util::EventObjectjava::lang::Object
[legend]
Collaboration diagram for java::awt::event::ActionEvent:

Collaboration graph
java::awt::AWTEventjava::util::EventObjectjava::lang::Objectjava::lang::ObjectRefjava::lang::Interfacejava::lang::Stringjava::lang::Comparable
[legend]

List of all members.


Detailed Description

A semantic event which indicates that a component-defined action occured.

This high-level event is generated by a component (such as a Button) when the component-specific action occurs (such as being pressed). The event is passed to every every ActionListener object that registered to receive such events using the component's addActionListener method.

The object that implements the ActionListener interface gets this ActionEvent when the event occurs. The listener is therefore spared the details of processing individual mouse movements and mouse clicks, and can instead process a "meaningful" (semantic) event like "button pressed".

See also:
ActionListener

Tutorial: Java 1.1 Event Model

Reference: The Java Class Libraries (update file)

Author:
Carl Quinn
Version:
1.25 01/23/03
Since:
1.1

Public Types

enum  ACTION_EVENT_ID { ACTION_FIRST = 1001, ACTION_PERFORMED = ACTION_FIRST, ACTION_LAST = ACTION_PERFORMED }

Public Member Functions

 ActionEvent (const ObjectRef &source=0, jint id=ACTION_PERFORMED, const String &command=nilString, jlong when=0, jint modifiers=0)
 Constructs an ActionEvent object with the specified modifier keys and timestamp.
virtual String getActionCommand () const
 Returns the command string associated with this action.
virtual jint getModifiers () const
 Returns the modifier keys held down during this action event.
virtual String paramString () const
 Returns a parameter string identifying this action event.

Protected Attributes

String actionCommand
 The nonlocalized string that gives more details of what actually caused the event.
jint modifiers
 This represents the key modifier that was selected, and is used to determine the state of the selected key.

Member Enumeration Documentation

enum java::awt::event::ActionEvent::ACTION_EVENT_ID

Enumerator:
ACTION_FIRST  The first number in the range of ids used for action events.
ACTION_PERFORMED  This event id indicates that a meaningful action occured.
ACTION_LAST  The last number in the range of ids used for action events.


Constructor & Destructor Documentation

java::awt::event::ActionEvent::ActionEvent ( const ObjectRef source = 0,
jint  id = ACTION_PERFORMED,
const String command = nilString,
jlong  when = 0,
jint  modifiers = 0 
)

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

Note that passing in an invalid id results in unspecified behavior.

Parameters:
source the object that originated the event
id an integer that identifies the event
command a string that may specify a command (possibly one of several) associated with the event
when the time the event occurred
modifiers the modifier keys held down during this action
Since:
1.4


Member Function Documentation

virtual String java::awt::event::ActionEvent::getActionCommand (  )  const [virtual]

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.

Returns:
the string identifying the command for this event

virtual jint java::awt::event::ActionEvent::getModifiers (  )  const [virtual]

Returns the modifier keys held down during this action event.

Returns:
the bitwise-or of the modifier constants

virtual String java::awt::event::ActionEvent::paramString (  )  const [virtual]

Returns a parameter string identifying this action event.

This method is useful for event-logging and for debugging.

Returns:
a string identifying the event and its associated command

Reimplemented from java::awt::AWTEvent.


Member Data Documentation

String java::awt::event::ActionEvent::actionCommand [protected]

The nonlocalized string that gives more details of what actually caused the event.

This information is very specific to the component that fired it.

See also:
getActionCommand

jint java::awt::event::ActionEvent::modifiers [protected]

This represents the key modifier that was selected, and is used to determine the state of the selected key.

If no modifier has been selected it will default to zero.

See also:
getModifiers


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:13 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3