位置:首頁 > 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