|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.awt.dnd.DragGestureRecognizer
public abstract class DragGestureRecognizer
DragGestureRecognizer 是一個針對與平臺相關的偵聽器規範的抽象基礎類別,它可以與特定 Component 關聯以標識與平臺相關的拖動開始動作。
可從與特定 Component 關聯的 DragSource,或通過其 createDragGestureRecognizer() 方法從 Toolkit 物件獲得合適的 DragGestureRecognizer 子類別。
DragGestureRecognizer 一旦與特定的 Component 關聯,就會在該 Component 上註冊合適的偵聽器介面,以追蹤傳遞給該 Component 的輸入事件。
DragGestureRecognizer 一旦將該 Component 上的事件順序標識為拖動開始動作,它就會通過調用其 gestureRecognized() 方法來通知其單播傳遞的 DragGestureListener。
當具體的 DragGestureRecognizer 實例在其關聯的 Component 上檢測到拖動開始動作時,它將觸發一個 DragGestureEvent,並針對 DragGestureListener 事件將其傳遞給在其單播傳遞事件源上註冊的 DragGestureListener。此 DragGestureListener 負責使關聯的 DragSource 開始 Drag 和 Drop 操作(如果合適)。
DragGestureListener,
DragGestureEvent,
DragSource,
序列化表格| 欄位摘要 | |
|---|---|
protected Component |
component
與此 DragGestureRecognizer 關聯的 Component。 |
protected DragGestureListener |
dragGestureListener
與此 DragGestureRecognizer 關聯的 DragGestureListener。 |
protected DragSource |
dragSource
與此 DragGestureRecognizer 關聯的 DragSource。 |
protected ArrayList<InputEvent> |
events
DragGestureRecognizer“識別”為觸發拖動的“動作”事件列表(按順序)。 |
protected int |
sourceActions
此 Drag 和 Drop 操作中所用動作型別的 int 表示形式。 |
| 建構子摘要 | |
|---|---|
protected |
DragGestureRecognizer(DragSource ds)
建構一個新的 DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource。 |
protected |
DragGestureRecognizer(DragSource ds,
Component c)
建構一個新的 DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource 和此 DragGestureRecognizer 應該“觀察”拖動開始動作的 Component。 |
protected |
DragGestureRecognizer(DragSource ds,
Component c,
int sa)
建構一個新的 DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource、此 DragGestureRecognizer 應該“觀察”拖動開始動作的 Component 和此 Drag 和 Drop 操作所支持的動作。 |
protected |
DragGestureRecognizer(DragSource ds,
Component c,
int sa,
DragGestureListener dgl)
建構一個新的 DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource、此 DragGestureRecognizer 應該“觀察”拖動開始動作的 Component、此 Drag 和 Drop 操作所支持的操作和一旦檢測到拖動開始動作要通知的 DragGestureListener。 |
| 方法摘要 | |
|---|---|
void |
addDragGestureListener(DragGestureListener dgl)
註冊一個新的 DragGestureListener。 |
protected void |
appendEvent(InputEvent awtie)
Recognizer 在 Component 上註冊的偵聽器將通過此 API 記錄所有識別的 Event,識別的 Event 是組成 Drag 和 Drop 開始動作的系列 Event 的一部分。 |
protected void |
fireDragGestureRecognized(int dragAction,
Point p)
通知 DragGestureListener 已發生了 Drag 和 Drop 開始動作。 |
Component |
getComponent()
此方法返回 DragGestureRecognizer 所“觀察”的 Component,以便瞭解拖動開始動作。 |
DragSource |
getDragSource()
此方法返回 DragSource,為了進行 Drag 和 Drop 操作,將使用此 DragGestureRecognizer。 |
int |
getSourceActions()
此方法返回 Drag 和 Drop 操作所支持動作型別的 int 表示形式。 |
InputEvent |
getTriggerEvent()
此方法返回發起 Drag 和 Drop 操作的系列事件中的首個事件。 |
protected abstract void |
registerListeners()
向該 Component 註冊此 DragGestureRecognizer 的 Listeners。 |
void |
removeDragGestureListener(DragGestureListener dgl)
取消註冊當前的 DragGestureListener |
void |
resetRecognizer()
重置 Recognizer,如果 Recognizer 當前正在識別一個動作,則忽略。 |
void |
setComponent(Component c)
設置與該 DragGestureRecognizer 關聯的 Component 使用此方法時還會調用 registerListeners() 和 unregisterListeners()。 |
void |
setSourceActions(int actions)
此方法設置此 Drag 和 Drop 操作允許的源拖動動作。 |
protected abstract void |
unregisterListeners()
向該 Component 取消註冊此 DragGestureRecognizer 的 Listeners。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 欄位詳細資訊 |
|---|
protected DragSource dragSource
DragGestureRecognizer 關聯的 DragSource。
protected Component component
DragGestureRecognizer 關聯的 Component。
protected transient DragGestureListener dragGestureListener
DragGestureRecognizer 關聯的 DragGestureListener。
protected int sourceActions
int 表示形式。
protected ArrayList<InputEvent> events
DragGestureRecognizer“識別”為觸發拖動的“動作”事件列表(按順序)。
| 建構子詳細資訊 |
|---|
protected DragGestureRecognizer(DragSource ds,
Component c,
int sa,
DragGestureListener dgl)
DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource、此 DragGestureRecognizer 應該“觀察”拖動開始動作的 Component、此 Drag 和 Drop 操作所支持的操作和一旦檢測到拖動開始動作要通知的 DragGestureListener。
ds - 此 DragGestureRecognizer 用於處理 Drag 和 Drop 操作的 DragSourcec - 為了檢測拖動開始動作,此 DragGestureRecognizer 應該“觀察”事件串流去往的 Component。如果此值為 null,則 DragGestureRecognizer 未與任何 Component 關聯。sa - 此 Drag 和 Drop 操作支持的 DnDConstants 集合(邏輯“或”)dgl - 檢測到拖動動作時要通知的 DragGestureRecognizer
IllegalArgumentException - 如果 ds 為 null。
protected DragGestureRecognizer(DragSource ds,
Component c,
int sa)
DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource、此 DragGestureRecognizer 應該“觀察”拖動開始動作的 Component 和此 Drag 和 Drop 操作所支持的動作。
ds - 此 DragGestureRecognizer 用於處理 Drag 和 Drop 操作的 DragSourcec - 為了檢測拖動開始動作,此 DragGestureRecognizer 應該“觀察”事件串流去往的 Component。如果此值為 null,則 DragGestureRecognizer 未與任何 Component 關聯。sa - 此 Drag 和 Drop 操作支持的 DnDConstants 集合(邏輯“或”)
IllegalArgumentException - 如果 ds 為 null。
protected DragGestureRecognizer(DragSource ds,
Component c)
DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource 和此 DragGestureRecognizer 應該“觀察”拖動開始動作的 Component。
ds - 此 DragGestureRecognizer 用於處理 Drag 和 Drop 操作的 DragSourcec - 為了檢測拖動開始動作,此 DragGestureRecognizer 應該“觀察”事件串流去往的 Component。如果此值為 null,則 DragGestureRecognizer 未與任何 Component 關聯。
IllegalArgumentException - 如果 ds 為 null。protected DragGestureRecognizer(DragSource ds)
DragGestureRecognizer,使其具有給定此 Drag 和 Drop 操作中使用的 DragSource。
ds - 此 DragGestureRecognizer 用於處理 Drag 和 Drop 操作的 DragSource
IllegalArgumentException - 如果 ds 為 null。| 方法詳細資訊 |
|---|
protected abstract void registerListeners()
protected abstract void unregisterListeners()
public DragSource getDragSource()
DragSource,為了進行 Drag 和 Drop 操作,將使用此 DragGestureRecognizer。
public Component getComponent()
DragGestureRecognizer 所“觀察”的 Component,以便瞭解拖動開始動作。
public void setComponent(Component c)
c - Component 或 nullpublic int getSourceActions()
public void setSourceActions(int actions)
actions - 允許的源拖動動作public InputEvent getTriggerEvent()
public void resetRecognizer()
public void addDragGestureListener(DragGestureListener dgl)
throws TooManyListenersException
DragGestureListener。
dgl - 使用此 DragGestureRecognizer 註冊的 DragGestureListener。
TooManyListenersException - 如果已經添加了 DragGestureListener。public void removeDragGestureListener(DragGestureListener dgl)
dgl - 使用此 DragGestureRecognizer 取消註冊的 DragGestureListener。
IllegalArgumentException - 如果 dgl 不是(等於)當前已註冊的 DragGestureListener。
protected void fireDragGestureRecognized(int dragAction,
Point p)
dragAction - 通過使用者動作初始選中的動作p - 該動作開始的 point(在 Component 坐標中)protected void appendEvent(InputEvent awtie)
DragGestureRecognizer 實作使用此方法將 InputEvent 子類別(相信它是組成 Drag 和 Drop 操作的系列事件的一部分)添加到此 DragGestureRecognizer 內部維護的事件陣列中。
awtie - 添加到此 DragGestureRecognizer 內部事件陣列的 InputEvent。注意,null 不是有效值,將忽略該值。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。