public abstract class DragGestureRecognizer extends Object implements Serializable
DragGestureRecognizer是一个用于规范平台相关侦听器的抽象基类,可以与特定的Component Component ,以便识别平台相关的拖动启动手势。
DragGestureRecognizer子类实例是从与特定 Component相关联的DragSource Component ,或通过其createDragGestureRecognizer()方法从Toolkit对象获得。
一旦DragGestureRecognizer与特定相关Component它将注册对相应的监听器接口Component ,以跟踪传递到输入事件Component 。
一旦DragGestureRecognizer Component上的一系列事件Component为拖动启动手势,它将通过调用其gestureRecognized()方法通知其单播DragGestureListener 。
当混凝土DragGestureRecognizer实例检测的拖拽在启动动作Component与其相关联,它触发一个DragGestureEvent至DragGestureListener单播事件源上用于注册DragGestureListener事件。 该DragGestureListener负责使关联的DragSource启动拖放操作(如果适用)。
DragGestureListener , DragGestureEvent , DragSource , Serialized Form
| 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表示此拖放操作中使用的操作类型。
|
| 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以用于此拖放操作,
Component此
DragGestureRecognizer应该“观察”用于拖动启动手势,以及此拖放操作支持的操作。
|
protected |
DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl)
构造一个新的
DragGestureRecognizer给定
DragSource用于这个拖放操作,
Component这个
DragGestureRecognizer应该“观察”拖动启动手势,这个拖放操作支持的动作,
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的Listeners与Component子类必须覆盖此方法
|
void |
removeDragGestureListener(DragGestureListener dgl)
取消注册当前的DragGestureListener
|
void |
resetRecognizer()
重置识别器,如果其当前识别手势,则忽略它。
|
void |
setComponent(Component c)
将DragGestureRecognizer与registerListeners()和unregisterListeners()相关联的组件设置为适当的副作用。
|
void |
setSourceActions(int actions)
此方法为此拖放操作设置允许的源拖动操作。
|
protected abstract void |
unregisterListeners()
使用Component子类取消注册此DragGestureRecognizer的侦听器必须覆盖此方法
|
protected DragSource dragSource
DragSource与此相关
DragGestureRecognizer 。
protected Component component
Component与此相关
DragGestureRecognizer 。
protected transient DragGestureListener dragGestureListener
DragGestureListener与此相关
DragGestureRecognizer 。
protected int sourceActions
int表示此拖放操作中使用的操作类型。
protected ArrayList<InputEvent> events
DragGestureRecognizer “识别”作为触发拖动的“手势”的事件列表(按顺序)。
protected DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl)
DragGestureRecognizer给定
DragSource用于这个拖放操作,
Component这个
DragGestureRecognizer应该“观察”拖动启动手势,这个拖放操作支持的动作,以及
DragGestureListener通知一次已经检测到拖动启动手势。
ds -
DragSource这个
DragGestureRecognizer将用于处理拖放操作
c - Component这个DragGestureRecognizer应该“观察”事件流,以便检测拖动启动手势。
如果这个值是null ,该DragGestureRecognizer不与任何相关Component 。
sa - 此拖放操作将支持的
DnDConstants的集合(逻辑或)
dgl -
DragGestureRecognizer通知何时检测到拖动手势
IllegalArgumentException - 如果ds是
null 。
protected DragGestureRecognizer(DragSource ds, Component c, int sa)
DragGestureRecognizer给定
DragSource用于此拖放操作,
Component此
DragGestureRecognizer应该“观察”用于拖动启动手势,以及此拖放操作支持的操作。
ds -
DragSource这个
DragGestureRecognizer将用于处理拖放操作
c - Component这个DragGestureRecognizer应该“观察”事件流,以便检测拖动启动手势。
如果这个值是null ,该DragGestureRecognizer不与任何相关Component 。
sa - 此拖放操作将支持的
DnDConstants的集合(逻辑或)
IllegalArgumentException - 如果ds是
null 。
protected DragGestureRecognizer(DragSource ds, Component c)
DragGestureRecognizer给定
DragSource用于此拖放操作,
Component此
DragGestureRecognizer应该“观察”拖动启动手势。
ds -
DragSource这个
DragGestureRecognizer将用于处理拖放操作
c - Component这个DragGestureRecognizer应该“观察”事件流,以便检测拖动启动手势。
如果这个值是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 - 允许的来源拖动动作
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 - 如果dgl不是(等于)当前注册的
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.