public abstract class DragGestureRecognizer extends Object implements Serializable
DragGestureRecognizer
是一个可以与一个特定的
Component
为了识别依赖于平台的拖启动手势相关平台依赖的听众的规范抽象基类。
适当的DragGestureRecognizer
子类的实例是从一个特定Component
相关的DragSource
获得,或从Toolkit
对象通过其createDragGestureRecognizer()
方法。
一旦DragGestureRecognizer
是与一个特定的Component
将登记相应的监听器接口以Component
跟踪输入事件传递到Component
相关。
一旦DragGestureRecognizer
标识序列对Component
事件拖累引发的姿态,它将通过调用其gestureRecognized()
方法通知其单播DragGestureListener
。
当混凝土DragGestureRecognizer
实例检测拖启动手势在Component
是相关联的,它发射一DragGestureEvent
的DragGestureListener
对DragGestureListener
事件的单播事件源注册。这DragGestureListener
是引起相关DragSource
启动拖放操作(如适用)。
Modifier and Type | Field and Description |
---|---|
protected Component |
component
与此相关的
Component
DragGestureRecognizer 。
|
protected DragGestureListener |
dragGestureListener
与此相关的
DragGestureListener
DragGestureRecognizer 。
|
protected DragSource |
dragSource
与此相关的
DragSource
DragGestureRecognizer 。
|
protected ArrayList<InputEvent> |
events
事件列表(按顺序),
DragGestureRecognizer “公认”为“手势”引发的阻力。
|
protected int |
sourceActions
代表类型的
int (S)行动(S)进行拖放操作。
|
Modifier | Constructor and Description |
---|---|
protected |
DragGestureRecognizer(DragSource ds)
构建一个新的
DragGestureRecognizer 给予
DragSource 用于拖放操作。
|
protected |
DragGestureRecognizer(DragSource ds, Component c)
构建一个新的
DragGestureRecognizer 给予
DragSource 用于拖放操作,和
Component 这
DragGestureRecognizer 应该“观察”拖动起始姿势。
|
protected |
DragGestureRecognizer(DragSource ds, Component c, int sa)
构建一个新的
DragGestureRecognizer 给予
DragSource 用于拖放操作,这
DragGestureRecognizer 应该“观察”引发的
Component 拖动手势,和行动(S)支持这个拖放操作。
|
protected |
DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl)
构建一个新的
DragGestureRecognizer 给予
DragSource 用于拖放操作,这
DragGestureRecognizer 应该“观察”引发的
Component 拖动手势,动作(S)这个拖放操作的支持,和
DragGestureListener 通知一旦拖启动手势已经被发现。
|
Modifier and Type | Method and Description |
---|---|
void |
addDragGestureListener(DragGestureListener dgl)
登记一个新的
DragGestureListener 。
|
protected void |
appendEvent(InputEvent awtie)
通过这个识别器的组件注册监听器应记录所有事件,是公认的事件,去组成一个拖放启动手势通过这个API的系列的一部分。
|
protected void |
fireDragGestureRecognized(int dragAction, Point p)
通知draggesturelistener发生拖放启动手势。
|
Component |
getComponent()
这个方法返回
Component 是“观察”的
DragGestureRecognizer 拖动起始姿势。
|
DragSource |
getDragSource()
这个方法返回
DragSource 这
DragGestureRecognizer 将用以处理拖放操作。
|
int |
getSourceActions()
此方法返回表示动作类型int()这个拖放操作支持。
|
InputEvent |
getTriggerEvent()
此方法返回启动拖放操作的事件序列中的第一个事件。
|
protected abstract void |
registerListeners()
登记本DragGestureRecognizer的听众与组件的子类必须重写此方法
|
void |
removeDragGestureListener(DragGestureListener dgl)
注销当前DragGestureListener
|
void |
resetRecognizer()
重置系统,如果其目前识别手势,忽略它。
|
void |
setComponent(Component c)
设置组件的draggesturerecognizer与registerlisteners()和unregisterlisteners()相关的被称为作为一个副作用是适当的。
|
void |
setSourceActions(int actions)
此方法设置此拖放操作的允许源拖放操作(S)。
|
protected abstract void |
unregisterListeners()
注销这DragGestureRecognizer的听众与组件的子类必须重写此方法
|
protected DragSource dragSource
DragSource
DragGestureRecognizer
。
protected Component component
Component
DragGestureRecognizer
。
protected transient DragGestureListener dragGestureListener
DragGestureListener
DragGestureRecognizer
。
protected int sourceActions
int
(S)行动(S)进行拖放操作。
protected ArrayList<InputEvent> events
DragGestureRecognizer
“公认”为“手势”引发的阻力。
protected DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl)
DragGestureRecognizer
给予
DragSource
用于拖放操作,这
DragGestureRecognizer
应该“观察”引发的
Component
拖动手势,动作(S)这个拖放操作的支持,和
DragGestureListener
通知一旦拖启动手势已经被发现。
ds
-
DragSource
这
DragGestureRecognizer
将使用过程中的拖放操作
c
-这
DragGestureRecognizer
应该“观察”的事件流的
Component
,为了检测拖启动手势。如果这个值是
null
的
DragGestureRecognizer
,不与任何
Component
相关。
sa
-集(逻辑或)的,这
DnDConstants
拖放操作支持
dgl
-
DragGestureRecognizer
通知时,拖动手势检测
IllegalArgumentException
如果DS是
null
。
protected DragGestureRecognizer(DragSource ds, Component c, int sa)
DragGestureRecognizer
给予
DragSource
用于拖放操作,这
DragGestureRecognizer
应该“观察”引发的
Component
拖动手势,和行动(S)支持这个拖放操作。
ds
-
DragSource
这
DragGestureRecognizer
将使用过程中的拖放操作
c
-这
DragGestureRecognizer
应该“观察”的事件流的
Component
,为了检测拖启动手势。如果这个值是
null
的
DragGestureRecognizer
,不与任何
Component
相关。
sa
-集(逻辑或)的
DnDConstants
这个拖放操作将支持
IllegalArgumentException
如果DS是
null
。
protected DragGestureRecognizer(DragSource ds, Component c)
DragGestureRecognizer
给予
DragSource
用于拖放操作,和
Component
这
DragGestureRecognizer
应该“观察”拖动起始姿势。
ds
-
DragSource
这
DragGestureRecognizer
将使用过程中的拖放操作
c
-这
DragGestureRecognizer
应该“观察”的事件流的
Component
,为了检测拖启动手势。如果这个值是
null
的
DragGestureRecognizer
,不与任何
Component
相关。
IllegalArgumentException
如果DS是
null
。
protected DragGestureRecognizer(DragSource ds)
DragGestureRecognizer
给予
DragSource
用于拖放操作。
ds
-
DragSource
这
DragGestureRecognizer
将使用过程中的拖放操作
IllegalArgumentException
如果DS是
null
。
protected abstract void registerListeners()
protected abstract void unregisterListeners()
public DragSource getDragSource()
DragSource
这
DragGestureRecognizer
将用以处理拖放操作。
public Component getComponent()
Component
是“观察”的
DragGestureRecognizer
拖动起始姿势。
public void setComponent(Component c)
c
-
Component
或
null
public int getSourceActions()
public void setSourceActions(int actions)
actions
-允许源拖动操作(S)
public InputEvent getTriggerEvent()
public void resetRecognizer()
public void addDragGestureListener(DragGestureListener dgl) throws TooManyListenersException
DragGestureListener
。
dgl
-
DragGestureListener
与这个
DragGestureRecognizer
登记。
TooManyListenersException
-如果一个
DragGestureListener
已添加。
public void removeDragGestureListener(DragGestureListener dgl)
dgl
-
DragGestureListener
注销这
DragGestureRecognizer
IllegalArgumentException
(等于)目前注册
DragGestureListener
。
protected void fireDragGestureRecognized(int dragAction, Point p)
dragAction
由用户最初选择的动作手势
p
-点(在元件坐标)的手势起源
protected void appendEvent(InputEvent awtie)
这种方法是通过一个DragGestureRecognizer
实现添加一个InputEvent
类(它认为是一个在一系列的事件,包括拖放操作)对这DragGestureRecognizer
保持内部事件的数组。
awtie
-
InputEvent
添加到事件
DragGestureRecognizer
内部阵列。注意,
null
不是有效值,并将被忽略。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.