Class SwingDragger
java.lang.Object
com.inductiveautomation.snap.swing.SwingDragger
- All Implemented Interfaces:
DragSourceListener
,DragSourceMotionListener
,EventListener
A class to manage dragging.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates new drag source listener.protected Transferable
Creates a transferable for DragItem.static Transferable
createTransferable
(Object anItem) Creates a transferable for given object.void
dragDropEnd
(DragSourceDropEvent anEvent) DragSourceListener method.void
dragEnter
(DragSourceDragEvent anEvent) DragSourceListener method.void
dragExit
(DragSourceEvent anEvent) DragSourceListener method.void
dragMouseMoved
(DragSourceDragEvent anEvent) DragSourceMotionListener method.void
dragOver
(DragSourceDragEvent anEvent) DragSourceListener method.void
dropActionChanged
(DragSourceDragEvent anEvent) DragSourceListener method.static SwingDragger
Returns the currently active dragger.protected JComponent
Returns the component.Returns the DragGestureEvent.Returns the image to be dragged.protected Point
Returns the drag image offset point.Returns the point that the drag image should be dragged by.Returns the item really being dragged.<T> T
getDragItem
(Class<T> aClass) Returns the drag item as given class.Returns the drag item as string.Returns the DragSource.Returns the optional DragSourceListener.Sets the transferable.void
setDragGestureEvent
(DragGestureEvent anEvent) Sets the DragGestureEvent.void
setDragImage
(Image anImage) Sets the image to be dragged.void
setDragImageFromString
(String aString, Font aFont) Sets the drag image from given string and font.void
setDragImagePoint
(double anX, double aY) Returns the point that the drag image should be dragged by.void
setDragImagePoint
(Point aPoint) Returns the point that the drag image should be dragged by.void
setDragItem
(Object anItem) Sets the item really being dragged.void
setDragSourceListener
(DragSourceListener aListener) Sets an optional DragSourceListener.void
setTransferable
(Transferable aTrans) Sets the transferable.void
setTransferable
(String aString) Sets the transferable from string.void
Starts the drag.
-
Constructor Details
-
SwingDragger
public SwingDragger()
-
-
Method Details
-
getDragItem
Returns the item really being dragged. -
setDragItem
Sets the item really being dragged. -
getDragItem
Returns the drag item as given class. -
getDragItemString
Returns the drag item as string. -
getDragGestureEvent
Returns the DragGestureEvent. -
setDragGestureEvent
Sets the DragGestureEvent. -
getDragImage
Returns the image to be dragged. -
setDragImage
Sets the image to be dragged. -
setDragImageFromString
Sets the drag image from given string and font. -
getDragImagePoint
Returns the point that the drag image should be dragged by. -
setDragImagePoint
Returns the point that the drag image should be dragged by. -
setDragImagePoint
public void setDragImagePoint(double anX, double aY) Returns the point that the drag image should be dragged by. -
getDragImageOffset
Returns the drag image offset point. -
getTransferable
Sets the transferable. -
setTransferable
Sets the transferable. -
setTransferable
Sets the transferable from string. -
createTransferable
Creates a transferable for DragItem. -
createTransferable
Creates a transferable for given object. -
getDragSourceListener
Returns the optional DragSourceListener. -
setDragSourceListener
Sets an optional DragSourceListener. -
getComponent
Returns the component. -
getDragSource
Returns the DragSource. -
startDrag
public void startDrag()Starts the drag. -
getActiveDragger
Returns the currently active dragger. -
createDragWindow
protected void createDragWindow()Creates new drag source listener. -
dragEnter
DragSourceListener method.- Specified by:
dragEnter
in interfaceDragSourceListener
-
dragMouseMoved
DragSourceMotionListener method.- Specified by:
dragMouseMoved
in interfaceDragSourceMotionListener
-
dragDropEnd
DragSourceListener method.- Specified by:
dragDropEnd
in interfaceDragSourceListener
-
dragOver
DragSourceListener method.- Specified by:
dragOver
in interfaceDragSourceListener
-
dragExit
DragSourceListener method.- Specified by:
dragExit
in interfaceDragSourceListener
-
dropActionChanged
DragSourceListener method.- Specified by:
dropActionChanged
in interfaceDragSourceListener
-