位置:首页 > Java技术 > Swing > SWING ActionEvent事件类

SWING ActionEvent事件类

这个类定义在 java.awt.event包。按钮被点击时,会生成ActionEvent双击或列表中的项目。

类声明

以下是声明 java.awt.event.ActionEvent类:

public class ActionEvent
   extends AWTEvent

字段域

以下是java.awt.event.ActionEvent类字段域:

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

类构造函数

S.N. 构造函数 & 描述
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.

类方法

S.N. 方法 & 描述
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.

方法继承

这个类从以下类继承的方法:

  • java.awt.AWTEvent

  • java.util.EventObject

  • java.lang.Object