public class DnDHandler
extends java.lang.Object
implements java.awt.dnd.peer.DragSourceContextPeer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
| Constructor and Description |
|---|
DnDHandler(java.awt.dnd.DragGestureEvent trigger)
Constructs a DnDHandler using the drag gesture trigger
|
| Modifier and Type | Method and Description |
|---|---|
static java.awt.dnd.DragSource |
createDragSource()
This creates the appropriate drag source.
|
static java.awt.dnd.DropTarget |
createDropTarget(java.awt.Component c,
java.awt.dnd.DropTargetListener dtl)
This creates the appropriate drop target.
|
java.awt.Cursor |
getCursor()
Returns the current cursor
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Called when the mouse has been pressed and released
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Called when the mouse is being dragged
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Called when the mouse has entered the component
|
void |
mouseExited(java.awt.event.MouseEvent e)
Called when the mouse leaves the component
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Called when the mouse has moved
|
void |
mousePressed(java.awt.event.MouseEvent e)
Called when the mouse is pressed.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Called when the mouse is released.
|
void |
setCursor(java.awt.Cursor cursor)
Sets the current cursor
|
void |
startDrag(java.awt.dnd.DragSourceContext dsc,
java.awt.Cursor cursor,
java.awt.Image dragImage,
java.awt.Point imageOffset)
Starts the drag operation for a drag context
|
void |
transferablesFlavorsChanged()
Called if the transferable data flavors change
|
public DnDHandler(java.awt.dnd.DragGestureEvent trigger)
trigger - The DragGestureEventpublic void startDrag(java.awt.dnd.DragSourceContext dsc,
java.awt.Cursor cursor,
java.awt.Image dragImage,
java.awt.Point imageOffset)
throws java.awt.dnd.InvalidDnDOperationException
startDrag in interface java.awt.dnd.peer.DragSourceContextPeerdsc - The DragSourceContextcursor - The initial cursordragImage - The image to be show during draggingimageOffset - The offset of the image from the cursorjava.awt.dnd.InvalidDnDOperationExceptionpublic java.awt.Cursor getCursor()
getCursor in interface java.awt.dnd.peer.DragSourceContextPeerpublic void setCursor(java.awt.Cursor cursor)
throws java.awt.dnd.InvalidDnDOperationException
setCursor in interface java.awt.dnd.peer.DragSourceContextPeercursor - The current cursorjava.awt.dnd.InvalidDnDOperationExceptionpublic void transferablesFlavorsChanged()
transferablesFlavorsChanged in interface java.awt.dnd.peer.DragSourceContextPeerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenere - The mouse eventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenere - The mouse eventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenere - The mouse eventpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - The mouse eventpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenere - The mouse eventpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - The mouse eventpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenere - The mouse eventpublic static java.awt.dnd.DragSource createDragSource()
public static java.awt.dnd.DropTarget createDropTarget(java.awt.Component c,
java.awt.dnd.DropTargetListener dtl)
c - the component which is the drop targetdtl - The drop raget listener