// 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(); if (notches < 0) C.scaleByG( wheelScalingFactor);// mouse scroll up else C.scaleByG( 1./wheelScalingFactor); // mouse scroll down } }