- java.lang.Object
-
- java.awt.dnd.DragGestureRecognizer
-
- java.awt.dnd.MouseDragGestureRecognizer
-
- All Implemented Interfaces:
-
MouseListener
,MouseMotionListener
,Serializable
,EventListener
public abstract class MouseDragGestureRecognizer extends DragGestureRecognizer implements MouseListener, MouseMotionListener
DragGestureRecognizer
这个抽象子类定义了一个基于鼠标的手势的DragGestureRecognizer
。 每个平台通过Toolkit.createDragGestureRecognizer()方法实现了自己具有的这个类的具体子类,以便对启动拖放操作的平台相关鼠标手势的识别进行封装。鼠标拖动手势识别器应该遵守拖动手势运动阈值,可通过
DragSource.getDragThreshold()
获得 。 只有当最新的鼠标拖动事件的位置与相应的鼠标按钮按下事件的位置之间的水平或垂直方向上的距离大于拖动手势运动阈值时才能识别拖动手势。使用
DragSource.createDefaultDragGestureRecognizer(java.awt.Component, int, java.awt.dnd.DragGestureListener)
创建的拖动手势识别器遵循此惯例。- 另请参见:
-
DragGestureListener
,DragGestureEvent
,DragSource
, Serialized Form
-
-
Field Summary
-
Fields inherited from class java.awt.dnd.DragGestureRecognizer
component, dragGestureListener, dragSource, events, sourceActions
-
-
构造方法摘要
构造方法 Modifier Constructor 描述 protected
MouseDragGestureRecognizer(DragSource ds)
构造新的MouseDragGestureRecognizer
给予DragSource
为Component
。protected
MouseDragGestureRecognizer(DragSource ds, Component c)
构建新的MouseDragGestureRecognizer
给予DragSource
为Component
c和Component
观察。protected
MouseDragGestureRecognizer(DragSource ds, Component c, int act)
构造新的MouseDragGestureRecognizer
给予DragSource
为Component
c,Component
观察,并允许这种拖动操作的动作。protected
MouseDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl)
构造一个新的MouseDragGestureRecognizer
给出DragSource
为Component
c,Component
观察,这个拖动操作允许的动作,以及DragGestureListener
通知何时检测到拖动手势。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 void
mouseClicked(MouseEvent e)
当鼠标点击组件时调用。void
mouseDragged(MouseEvent e)
在组件上按下鼠标按钮时调用。void
mouseEntered(MouseEvent e)
当鼠标进入组件时调用。void
mouseExited(MouseEvent e)
当鼠标退出组件时调用。void
mouseMoved(MouseEvent e)
在组件上移动鼠标按钮时调用(没有按钮没有关闭)。void
mousePressed(MouseEvent e)
在Component
上按下鼠标按钮时调用。void
mouseReleased(MouseEvent e)
在组件上释放鼠标按钮时调用。protected void
registerListeners()
使用组件注册此DragGestureRecognizer的侦听器protected void
unregisterListeners()
使用Component子类取消注册此DragGestureRecognizer的侦听器必须覆盖此方法-
Methods inherited from class java.awt.dnd.DragGestureRecognizer
addDragGestureListener, appendEvent, fireDragGestureRecognized, getComponent, getDragSource, getSourceActions, getTriggerEvent, removeDragGestureListener, resetRecognizer, setComponent, setSourceActions
-
-
-
-
构造方法详细信息
-
MouseDragGestureRecognizer
protected MouseDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl)
构造一个新的MouseDragGestureRecognizer
给出DragSource
为Component
c,Component
观察,这个拖动操作允许的动作,以及DragGestureListener
通知何时检测到拖动手势。- 参数
-
ds
- 组件的DragSource c -
c
- 要观察的组件 -
act
- 此拖动允许的操作 -
dgl
- 当检测到手势时通知DragGestureListener
-
MouseDragGestureRecognizer
protected MouseDragGestureRecognizer(DragSource ds, Component c, int act)
构造一个新的MouseDragGestureRecognizer
给予DragSource
为Component
c,Component
观察,并允许这个拖动操作的动作。- 参数
-
ds
- 组件的DragSource c -
c
- 要观察的组件 -
act
- 此拖动允许的操作
-
MouseDragGestureRecognizer
protected MouseDragGestureRecognizer(DragSource ds, Component c)
构建新的MouseDragGestureRecognizer
给予DragSource
为Component
c和Component
观察。- 参数
-
ds
- 组件的DragSource c -
c
- 要观察的组件
-
MouseDragGestureRecognizer
protected MouseDragGestureRecognizer(DragSource ds)
构造一个新的MouseDragGestureRecognizer
给予DragSource
为Component
。- 参数
-
ds
- 组件的DragSource
-
-
方法详细信息
-
registerListeners
protected void registerListeners()
使用组件注册此DragGestureRecognizer的侦听器- Specified by:
-
registerListeners
在DragGestureRecognizer
-
unregisterListeners
protected void unregisterListeners()
使用Component子类取消注册此DragGestureRecognizer的侦听器必须覆盖此方法- Specified by:
-
unregisterListeners
在DragGestureRecognizer
-
mouseClicked
public void mouseClicked(MouseEvent e)
当鼠标点击组件时调用。- Specified by:
-
mouseClicked
接口MouseListener
- 参数
-
e
-MouseEvent
-
mousePressed
public void mousePressed(MouseEvent e)
在Component
上按下鼠标按钮时调用。- Specified by:
-
mousePressed
接口MouseListener
- 参数
-
e
-MouseEvent
-
mouseReleased
public void mouseReleased(MouseEvent e)
在组件上释放鼠标按钮时调用。- Specified by:
-
mouseReleased
接口MouseListener
- 参数
-
e
-MouseEvent
-
mouseEntered
public void mouseEntered(MouseEvent e)
当鼠标进入组件时调用。- Specified by:
-
mouseEntered
在接口MouseListener
- 参数
-
e
-MouseEvent
-
mouseExited
public void mouseExited(MouseEvent e)
当鼠标退出组件时调用。- Specified by:
-
mouseExited
在接口MouseListener
- 参数
-
e
-MouseEvent
-
mouseDragged
public void mouseDragged(MouseEvent e)
在组件上按下鼠标按钮时调用。- Specified by:
-
mouseDragged
在接口MouseMotionListener
- 参数
-
e
-MouseEvent
-
mouseMoved
public void mouseMoved(MouseEvent e)
在组件上移动鼠标按钮时调用(没有按钮没有关闭)。- Specified by:
-
mouseMoved
在接口MouseMotionListener
- 参数
-
e
- theMouseEvent
-
-