Point p = f.getLocationOnScreen();
p.translate(f.getWidth() / 2, 5);
r.mouseMove((int) p.getX(), (int) p.getY());
r.mousePress(InputEvent.BUTTON1_MASK);
for (int i = 0; i < 100; i++) {
r.mouseMove((int) p.getX() + i, (int) p.getY() + i);
}
r.mouseRelease(InputEvent.BUTTON1_MASK);
t.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseMoved(MouseEvent event) {
Point p = event.getPoint();