postEvent(createMouseEvent(MouseEvent.MOUSE_ENTERED, 0, start.x, start.y, modifiers));
boolean doneExit = false; // set to true when we have simulated the
// mouse exit
postEvent(createMouseEvent(MouseEvent.MOUSE_PRESSED, 1, start.x, start.y, modifiers));
new Snooze(10);
postEvent(createMouseEvent(MouseEvent.MOUSE_DRAGGED, 1, start.x, start.y, modifiers));
if (subDelayInMS > 0) {
new Snooze(subDelayInMS);
AWTSync.sync();
}
new Snooze(10);
int midX = (start.x + end.x) / 2, midY = (start.y + end.y) / 2;
if (!doneExit && !componentContains(midX, midY)) {
postEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, 1, midX, midY, modifiers));
doneExit = true;
}
postEvent(createMouseEvent(MouseEvent.MOUSE_DRAGGED, 1, midX, midY, modifiers));
if (subDelayInMS > 0) {
new Snooze(subDelayInMS);
AWTSync.sync();
}
new Snooze(10);
if (!doneExit && !componentContains(end.x, midY)) {
postEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, 1, end.x, end.y, modifiers));
doneExit = true;
}
postEvent(createMouseEvent(MouseEvent.MOUSE_DRAGGED, 1, end.x, end.y, modifiers));
if (subDelayInMS > 0) {
new Snooze(subDelayInMS);
AWTSync.sync();
}
new Snooze(10);
postEvent(createMouseEvent(MouseEvent.MOUSE_RELEASED, 1, end.x, end.y, modifiers));
// No, drags shouldn't generate clicks.
// If a gesture has been determined a drag by Marathon and recorded as
// such, it should
// be beyond the tolerance for small drags within a click.
// postEvent(createMouseEvent(MouseEvent.MOUSE_CLICKED, 1, end.x, end.y,
// modifiers));
if (!doneExit) {
new Snooze(10);
postEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, 1, end.x, end.y, modifiers));
doneExit = true;
}
}