public void mouseMove(int x,int y,int dx,int dy,int button){
  if ((mouseX < 0) || (Math.abs(dx) > 100) || (Math.abs(dy) > 100)) {
    dx=0;
    dy=0;
  }
 else {
    dx=x - mouseX;
    dy=y - mouseY;
  }
  mouseX=x;
  mouseY=y;
switch (button) {
case 0:
    mouseX=-1;
  mouseY=-1;
break;
case 1:
long now=System.currentTimeMillis();
long elapsed=now - timestamp;
timestamp=now;
double delta=Math.sqrt(dx * dx + dy * dy);
velocity=(100 * delta / (1 + elapsed)) * 0.8 + 0.2 * velocity;
viewpointNode.drag(dx,dy);
lastDx=dx;
lastDy=dy;
break;
case 2:
viewpointNode.translateInScreenPlane(-dx,-dy);
break;
case 3:
viewpointNode.rotate(dy,dx);
break;
}
}

public void mouseMove ( int x , int y , int dx , int dy , int button ) { if ( ( mouseX < 0 ) || ( Math . abs ( dx ) > 100 ) || ( Math . abs ( dy ) > 100 ) ) { dx = 0 ; dy = 0 ; } else { dx = x - mouseX ; dy = y - mouseY ; } mouseX = x ; mouseY = y ; switch ( button ) { case 0 : mouseX = - 1 ; mouseY = - 1 ; break ; case 1 : long now = System . currentTimeMillis ( ) ; long elapsed = now - timestamp ; timestamp = now ; double delta = Math . sqrt ( dx * dx + dy * dy ) ; velocity = ( 100 * delta / ( 1 + elapsed ) ) * 0.8 + 0.2 * velocity ; viewpointNode . drag ( dx , dy ) ; lastDx = dx ; lastDy = dy ; break ; case 2 : viewpointNode . translateInScreenPlane ( - dx , - dy ) ; break ; case 3 : viewpointNode . rotate ( dy , dx ) ; break ; } }
handle a mouse move .
