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 int
Number of pixels traversed before a drag starts.private final Robot
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
private int
distance
(int coordinate, int dimension) void
Performs a drag action at the given point.private void
void
Move the mouse appropriately to get from the source to the destination.void
Ends a drag operation, releasing the mouse button over the given target location.private void
private void
private void
mouseMoveOnWindowsAndMacintosh
(Component target, int x, int y) private Point
point
(int x, int y) private Settings
settings()
-
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
-