| 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.util.EventObject
java.awt.AWTEvent
java.awt.event.ActionEvent
public class ActionEvent
指示发生了组件定义的动作的语义事件。当特定于组件的动作(比如被按下)发生时,由组件(比如 Button)生成此高级别事件。事件被传递给每一个 ActionListener 对象,这些对象是使用组件的 addActionListener 方法注册的,用以接收这类事件。
 
注:要使用键盘在 Button 上触发 ActionEvent,请使用空格键。
 
实现 ActionListener 接口的对象在发生事件时获得此 ActionEvent。因此,侦听器不必处理个别鼠标移动和鼠标单击的细节,而是可以处理像“按下按钮”这样的“有意义”(语义)事件。
ActionListener, 
Tutorial: Java 1.1 Event Model, 
Reference: The Java Class Libraries (update file), 
序列化表格| 字段摘要 | |
|---|---|
static int | 
ACTION_FIRST
用于标识动作事件的 ID 序列的起始编号。  | 
static int | 
ACTION_LAST
用于标识动作事件的 ID 序列的结束编号。  | 
static int | 
ACTION_PERFORMED
此事件 id 指示发生了有意义的动作。  | 
static int | 
ALT_MASK
alt 修饰符。  | 
static int | 
CTRL_MASK
Ctrl 修饰符。  | 
static int | 
META_MASK
meta 修饰符。  | 
static int | 
SHIFT_MASK
shift 修饰符。  | 
| 从类 java.util.EventObject 继承的字段 | 
|---|
source | 
| 构造方法摘要 | |
|---|---|
ActionEvent(Object source,
            int id,
            String command)
构造一个 ActionEvent 对象。 | 
|
ActionEvent(Object source,
            int id,
            String command,
            int modifiers)
使用组合键构造一个 ActionEvent 对象。 | 
|
ActionEvent(Object source,
            int id,
            String command,
            long when,
            int modifiers)
使用指定组合键和时间戳构造一个 ActionEvent 对象。 | 
|
| 方法摘要 | |
|---|---|
 String | 
getActionCommand()
返回与此动作相关的命令字符串。  | 
 int | 
getModifiers()
返回发生此动作事件期间按下的组合键。  | 
 long | 
getWhen()
返回发生此事件时的时间戳。  | 
 String | 
paramString()
返回标识此动作事件的参数字符串。  | 
| 从类 java.awt.AWTEvent 继承的方法 | 
|---|
consume, getID, isConsumed, setSource, toString | 
| 从类 java.util.EventObject 继承的方法 | 
|---|
getSource | 
| 从类 java.lang.Object 继承的方法 | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| 字段详细信息 | 
|---|
public static final int SHIFT_MASK
public static final int CTRL_MASK
public static final int META_MASK
public static final int ALT_MASK
public static final int ACTION_FIRST
public static final int ACTION_LAST
public static final int ACTION_PERFORMED
| 构造方法详细信息 | 
|---|
public ActionEvent(Object source,
                   int id,
                   String command)
ActionEvent 对象。
 
注意,传入无效 id 会导致未指定的行为。如果 source 为 null,则此方法抛出 IllegalArgumentException。为 null 的 command 字符串是合法的,但不建议使用。
source - 发起事件的对象id - 标识事件的整数command - 一个字符串,它可以用来指定与事件所相关的一条命令(可能是几个中的一个)
IllegalArgumentException - 如果 source 为 null
public ActionEvent(Object source,
                   int id,
                   String command,
                   int modifiers)
ActionEvent 对象。
 
注意,传入无效 id 会导致未指定的行为。如果 source 为 null,则此方法抛出 IllegalArgumentException。为 null 的 command 字符串是合法的,但不建议使用。
source - 发起事件的对象id - 标识事件的整数command - 一个字符串,它可以用来指定与事件所相关的一条命令(可能是几个中的一个)modifiers - 进行此动作期间按下的组合键
IllegalArgumentException - 如果 source 为 null
public ActionEvent(Object source,
                   int id,
                   String command,
                   long when,
                   int modifiers)
ActionEvent 对象。
 
注意,传入无效 id 会导致未指定的行为。如果 source 为 null,则此方法抛出 IllegalArgumentException。为 null 的 command 字符串是合法的,但不建议使用。
source - 发起事件的对象id - 标识事件的整数command - 一个字符串,它可以用来指定与事件所相关的一条命令(可能是几个中的一个)when - 发生事件的时间modifiers - 进行此动作期间按下的组合键
IllegalArgumentException - 如果 source 为 null| 方法详细信息 | 
|---|
public String getActionCommand()
注意,如果将 null 命令字符串传递给此 ActionEvent 的构造方法,则此方法返回 null。
public long getWhen()
public int getModifiers()
public String paramString()
AWTEvent 中的 paramString
  | 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。