// IN SETUP(), WE ADD ONE LINE OF CODE TO MAKE OUR LISTENER LISTEN TO OUR CURRENT WINDOW this.addMouseWheelListener(new CMouseWheelEvent()); float wheelScalingFactor=1.1; //magnification factor class CMouseWheelEvent implements MouseWheelListener { public CMouseWheelEvent() {} public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); C.pose(); float r=0.5*width/Rbox; float y=-(10.*notches)/r; C.anchor(); C.D=C.sD+y; C.pullE(); C1.track(C); C2.track(C1); C2.apply(); } }