look at mouseDragged() method, line 270.