APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.dnd

public abstract Class MouseDragGestureRecognizer

extends DragGestureRecognizer
implements MouseListener, MouseMotionListener
Class Inheritance
All Implemented Interfaces
java.awt.event.MouseMotionListener, java.util.EventListener, java.awt.event.MouseListener
Known Direct Subclasses
sun.awt.X11.XMouseDragGestureRecognizer
Imports
java.awt.Component, java.awt.event.MouseEvent, .MouseListener, .MouseMotionListener, java.io.Serial

This abstract subclass of DragGestureRecognizer defines a DragGestureRecognizer for mouse-based gestures. Each platform implements its own concrete subclass of this class, available via the Toolkit.createDragGestureRecognizer() method, to encapsulate the recognition of the platform dependent mouse gesture(s) that initiate a Drag and Drop operation.

Mouse drag gesture recognizers should honor the drag gesture motion threshold, available through DragSource#getDragThreshold. A drag gesture should be recognized only when the distance in either the horizontal or vertical direction between the location of the latest mouse dragged event and the location of the corresponding mouse button pressed event is greater than the drag gesture motion threshold.

Drag gesture recognizers created with DragSource#createDefaultDragGestureRecognizer follow this convention.

Author
Laurence P. G. Cable
See Also
java.awt.dnd.DragGestureListener, java.awt.dnd.DragGestureEvent, java.awt.dnd.DragSource

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.awt.dnd.DragGestureRecognizer.serialVersionUID.

Use serialVersionUID from JDK 1.4 for interoperability.
Inherited from java.awt.dnd.DragGestureRecognizer:
componentdragGestureListenerdragSourceeventssourceActions

Constructor Summary

AccessConstructor and Description
protected
MouseDragGestureRecognizer(DragSource
The DragSource for the Component c
ds
,
Component
The Component to observe
c
,
int
The actions permitted for this Drag
act
,
DragGestureListener
The DragGestureListener to notify when a gesture is detected
dgl
)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component c, the Component to observe, the action(s) permitted for this drag operation, and the DragGestureListener to notify when a drag gesture is detected.

protected
MouseDragGestureRecognizer(DragSource
The DragSource for the Component c
ds
,
Component
The Component to observe
c
,
int
The actions permitted for this drag
act
)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component c, the Component to observe, and the action(s) permitted for this drag operation.

protected
MouseDragGestureRecognizer(DragSource
The DragSource for the Component c
ds
,
Component
The Component to observe
c
)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component c, and the Component to observe.

protected
MouseDragGestureRecognizer(DragSource
The DragSource for the Component
ds
)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component.

Method Summary

Modifier and TypeMethod and Description
public void
mouseClicked(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse has been clicked on a component.

public void
mouseDragged(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component.

public void
mouseEntered(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

public void
mouseExited(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

public void
mouseMoved(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse button has been moved on a component (with no buttons no down).

public void
mousePressed(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a Component.

public void
mouseReleased(MouseEvent
the MouseEvent
e
)

Implements java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

protected void
registerListeners()

Implements abstract java.awt.dnd.DragGestureRecognizer.registerListeners.

register this DragGestureRecognizer's Listeners with the Component

protected void
unregisterListeners()

Implements abstract java.awt.dnd.DragGestureRecognizer.unregisterListeners.

unregister this DragGestureRecognizer's Listeners with the Component subclasses must override this method

Inherited from java.awt.dnd.DragGestureRecognizer:
addDragGestureListenerappendEventfireDragGestureRecognizedgetComponentgetDragSourcegetSourceActionsgetTriggerEventremoveDragGestureListenerresetRecognizersetComponentsetSourceActions

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.dnd.DragGestureRecognizer.serialVersionUID.

Use serialVersionUID from JDK 1.4 for interoperability.

Annotations
@Serial

Constructor Detail

MouseDragGestureRecognizerback to summary
protected MouseDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component c, the Component to observe, the action(s) permitted for this drag operation, and the DragGestureListener to notify when a drag gesture is detected.

Parameters
ds:DragSource

The DragSource for the Component c

c:Component

The Component to observe

act:int

The actions permitted for this Drag

dgl:DragGestureListener

The DragGestureListener to notify when a gesture is detected

MouseDragGestureRecognizerback to summary
protected MouseDragGestureRecognizer(DragSource ds, Component c, int act)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component c, the Component to observe, and the action(s) permitted for this drag operation.

Parameters
ds:DragSource

The DragSource for the Component c

c:Component

The Component to observe

act:int

The actions permitted for this drag

MouseDragGestureRecognizerback to summary
protected MouseDragGestureRecognizer(DragSource ds, Component c)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component c, and the Component to observe.

Parameters
ds:DragSource

The DragSource for the Component c

c:Component

The Component to observe

MouseDragGestureRecognizerback to summary
protected MouseDragGestureRecognizer(DragSource ds)

Construct a new MouseDragGestureRecognizer given the DragSource for the Component.

Parameters
ds:DragSource

The DragSource for the Component

Method Detail

mouseClickedback to summary
public void mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse has been clicked on a component.

Parameters
e:MouseEvent

the MouseEvent

mouseDraggedback to summary
public void mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component.

Parameters
e:MouseEvent

the MouseEvent

mouseEnteredback to summary
public void mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

Parameters
e:MouseEvent

the MouseEvent

mouseExitedback to summary
public void mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

Parameters
e:MouseEvent

the MouseEvent

mouseMovedback to summary
public void mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse button has been moved on a component (with no buttons no down).

Parameters
e:MouseEvent

the MouseEvent

mousePressedback to summary
public void mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a Component.

Parameters
e:MouseEvent

the MouseEvent

mouseReleasedback to summary
public void mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

Parameters
e:MouseEvent

the MouseEvent

registerListenersback to summary
protected void registerListeners()

Implements abstract java.awt.dnd.DragGestureRecognizer.registerListeners.

register this DragGestureRecognizer's Listeners with the Component

unregisterListenersback to summary
protected void unregisterListeners()

Implements abstract java.awt.dnd.DragGestureRecognizer.unregisterListeners.

unregister this DragGestureRecognizer's Listeners with the Component subclasses must override this method