Example #1
0
 @Override
 public void mouseUp(MouseEvent e) {
   dragging = false;
   ctrl.drag(0, 0);
   if (dx != 0 && dy != 0) {
     ctrl.move(dx, dy);
   }
   dx = dy = 0;
 }
Example #2
0
 @Override
 public void mouseMove(MouseEvent e) {
   if (dragging) {
     dx += e.x - lastX;
     dy += e.y - lastY;
     if (dx != 0 && dy != 0) {
       lastX = e.x;
       lastY = e.y;
       ctrl.drag(dx, dy);
     }
   }
 }