|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.swing.AbstractAction
public abstract class AbstractAction
此類別提供 JFC Action 介面的預設實作。它定義了一些標準行為,比如 Action 物件屬性(icon、text 和 enabled)的 get 和 set 方法。開發人員只需為此抽象類別創建子類別並定義 actionPerformed 方法即可。
警告:此類別的已序列化物件與以後的 Swing 版本不相容。當前序列化支持適用於短期存儲,或適用於在運行相同 Swing 版本的應用程序之間進行 RMI(Remote Method Invocation,遠端方法調用)。從 1.4 版本開始,已在 java.beans 套件中添加了支持所有 JavaBeansTM 長期存儲的功能。請參見 XMLEncoder。
Action| 欄位摘要 | |
|---|---|
protected SwingPropertyChangeSupport |
changeSupport
如果已經註冊了任意 PropertyChangeListener,則 changeSupport 欄位負責描述它們。 |
protected boolean |
enabled
指定是否啟用操作;預設值為 true。 |
| 從介面 javax.swing.Action 繼承的欄位 |
|---|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
| 建構子摘要 | |
|---|---|
AbstractAction()
用預設描述字元串和預設圖標定義一個 Action 物件。 |
|
AbstractAction(String name)
用指定描述字元串和預設圖標定義一個 Action 物件。 |
|
AbstractAction(String name,
Icon icon)
用指定描述字元串和指定圖標定義一個 Action 物件。 |
|
| 方法摘要 | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
向偵聽器列表添加一個 PropertyChangeListener。 |
protected Object |
clone()
複製抽象操作。 |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
支持報告綁定 (bound) 屬性的改變。 |
Object[] |
getKeys()
返回 Object 的陣列,這些物件是一些已經為其設置此 AbstractAction 值的鍵,如果沒有已經設置該值的鍵,則返回 null。 |
PropertyChangeListener[] |
getPropertyChangeListeners()
返回使用 addPropertyChangeListener() 添加到此 AbstractAction 中的所有 PropertyChangeListener 組成的陣列。 |
Object |
getValue(String key)
獲得與指定鍵關聯的 Object。 |
boolean |
isEnabled()
如果啟用該操作,則返回 true。 |
void |
putValue(String key,
Object newValue)
設置與指定鍵關聯的 Value。 |
void |
removePropertyChangeListener(PropertyChangeListener listener)
從偵聽器列表中移除一個 PropertyChangeListener。 |
void |
setEnabled(boolean newValue)
啟用或禁用該操作。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 從介面 java.awt.event.ActionListener 繼承的方法 |
|---|
actionPerformed |
| 欄位詳細資訊 |
|---|
protected boolean enabled
protected SwingPropertyChangeSupport changeSupport
PropertyChangeListener,則 changeSupport 欄位負責描述它們。
| 建構子詳細資訊 |
|---|
public AbstractAction()
Action 物件。
public AbstractAction(String name)
Action 物件。
public AbstractAction(String name,
Icon icon)
Action 物件。
| 方法詳細資訊 |
|---|
public Object getValue(String key)
Object。
Action 中的 getValuekey - 套件含指定 key 的字元串
Object;如果沒有鍵,則將返回 nullAction.getValue(java.lang.String)
public void putValue(String key,
Object newValue)
Value。
Action 中的 putValuekey - 標識所存儲物件的 StringnewValue - 將使用此鍵存儲的 ObjectAction.putValue(java.lang.String, java.lang.Object)public boolean isEnabled()
Action 中的 isEnabledAction.isEnabled()public void setEnabled(boolean newValue)
Action 中的 setEnablednewValue - 為 true 表示啟用該操作,為 false 表示禁用該操作Action.setEnabled(boolean)public Object[] getKeys()
Object 的陣列,這些物件是一些已經為其設置此 AbstractAction 值的鍵,如果沒有已經設置該值的鍵,則返回 null。
null
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
PropertyChangeListener 發送相應的 PropertyChangeEvent。
public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener。該偵聽器是為所有屬性註冊的。
在回應對綁定屬性(例如 setFont、setBackground 或 setForeground)的設置時,將觸發一個 PropertyChangeEvent。注意,如果當前元件將繼承其容器的前景、背景或字體,則在回應所繼承屬性中的更改時不會觸發任何事件。
Action 中的 addPropertyChangeListenerlistener - 要添加的 PropertyChangeListenerAction.addPropertyChangeListener(java.beans.PropertyChangeListener)public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener。此方法移除了一個為所有屬性註冊的 PropertyChangeListener。
Action 中的 removePropertyChangeListenerlistener - 要移除的 PropertyChangeListenerAction.removePropertyChangeListener(java.beans.PropertyChangeListener)public PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener 組成的陣列。
PropertyChangeListener,如果沒有添加偵聽器,則返回一個空陣列
protected Object clone()
throws CloneNotSupportedException
Object.clone() 為您處理。
Object 中的 cloneCloneNotSupportedException - 如果物件的類別不支持 Cloneable 介面,則覆寫 clone 方法的子類別也會拋出此異常,以指示無法複製某個實例。Cloneable
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。