Package org.fest.swing.core
Class ComponentDragAndDrop
java.lang.Object
org.fest.swing.core.ComponentDragAndDrop
Understands
Component-based drag and drop.- Since:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of pixels traversed before a drag starts.private final Robot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intprivate intdistance(int coordinate, int dimension) voidPerforms a drag action at the given point.private voidvoidMove the mouse appropriately to get from the source to the destination.voidEnds a drag operation, releasing the mouse button over the given target location.private voidprivate voidprivate voidmouseMoveOnWindowsAndMacintosh(Component target, int x, int y) private Pointpoint(int x, int y) private Settingssettings()
-
Field Details
-
robot
-
DRAG_THRESHOLD
public static final int DRAG_THRESHOLDNumber of pixels traversed before a drag starts.
-
-
Constructor Details
-
ComponentDragAndDrop
Creates a newComponentDragAndDrop.- Parameters:
robot- the robot to use to simulate user input.
-
-
Method Details
-
drag
Performs a drag action at the given point.- Parameters:
target- the target component.where- the point where to start the drag action.
-
mouseMove
-
mouseMoveOnWindowsAndMacintosh
-
distance
private int distance(int coordinate, int dimension) -
point
-
drop
Ends a drag operation, releasing the mouse button over the given target location.This method is tuned for native drag/drop operations, so if you get odd behavior, you might try using a simple
andRobot.moveMouse(Component, int, int).Robot.releaseMouseButtons()- Parameters:
target- the target component.where- the point where the drag operation ends.- Throws:
ActionFailedException- if there is no drag action in effect.
-
delayBetweenEvents
private int delayBetweenEvents() -
settings
-
dragOver
Move the mouse appropriately to get from the source to the destination. Enter/exit events will be generated where appropriate.- Parameters:
target- the target component.where- the point to drag over.
-
dragOver
-
mouseMove
-