private void zoom(java.awt.event.MouseWheelEvent evt)
    {
        isZooming = true;
        double zoomFactor = .2;
        int length=graph_screen.getWidth();
        int height=graph_screen.getHeight();
        xmin=Double.parseDouble(Xmin.getText());
        xmax=Double.parseDouble(Xmax.getText());
        ymin=Double.parseDouble(Ymin.getText());
        ymax=Double.parseDouble(Ymax.getText());
        int zoomx=evt.getX();int zoomy=evt.getY();
        double xRange=(xmax-xmin);double yRange=(ymax-ymin);
        int rotation = evt.getWheelRotation();
        double XmaxZoom=(-zoomFactor/length)*zoomx+zoomFactor;
        double XminZoom=Math.abs(XmaxZoom-zoomFactor);
        double YmaxZoom=(-zoomFactor/height)*zoomy+zoomFactor;
        double YminZoom=Math.abs(YmaxZoom-zoomFactor);
        //Zoom in/out
        if(rotation==-1)
        {
            ymin+=YmaxZoom*yRange;
            ymax-=YminZoom*yRange;
            xmin+=XminZoom*xRange;
            xmax-=XmaxZoom*xRange;            
        }else{
            //maximum zoom out range
            if(xRange<1999999*2&&yRange<1999999*2)
            {
            //maximum zoom in range
            if(xRange<=.04&&yRange<=.04)
            {
                xmin-=.02;
                xmax+=.02;
                ymin-=.02;
                ymax+=.02;
            }
            ymin-=YmaxZoom*yRange;
            ymax+=YminZoom*yRange;
            xmin-=XminZoom*xRange;
            xmax+=XmaxZoom*xRange;
            }
        }
        //write to bounds text fields
        DecimalFormat DForm = new DecimalFormat("#.##");
        xmin=Double.valueOf(DForm.format(xmin));
        xmax=Double.valueOf(DForm.format(xmax));
        ymin=Double.valueOf(DForm.format(ymin));
        ymax=Double.valueOf(DForm.format(ymax));
        Xmin.setText(Double.toString(xmin));
        Xmax.setText(Double.toString(xmax));
        Ymin.setText(Double.toString(ymin));
        Ymax.setText(Double.toString(ymax));
        //plot the zoomed graph
        plot();
        isZooming = false;
    }