Example usage for java.awt.event MouseWheelEvent isShiftDown

List of usage examples for java.awt.event MouseWheelEvent isShiftDown

Introduction

In this page you can find the example usage for java.awt.event MouseWheelEvent isShiftDown.

Prototype

public boolean isShiftDown() 

Source Link

Document

Returns whether or not the Shift modifier is down on this event.

Usage

From source file:org.forester.archaeopteryx.TreePanel.java

final public void mouseWheelMoved(final MouseWheelEvent e) {
    final int notches = e.getWheelRotation();
    if (inOvVirtualRectangle(e)) {
        if (!isInOvRect()) {
            setInOvRect(true);//w  w  w. j  av a2s  . c om
            repaint();
        }
    } else {
        if (isInOvRect()) {
            setInOvRect(false);
            repaint();
        }
    }
    if (e.isControlDown()) {
        if (notches < 0) {
            getTreeFontSet().increaseFontSize();
            getControlPanel().displayedPhylogenyMightHaveChanged(true);
        } else {
            getTreeFontSet().decreaseFontSize();
            getControlPanel().displayedPhylogenyMightHaveChanged(true);
        }
    } else if (e.isShiftDown()) {
        if ((getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED)
                || (getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR)) {
            if (notches < 0) {
                for (int i = 0; i < (-notches); ++i) {
                    setStartingAngle((getStartingAngle() % TWO_PI) + ANGLE_ROTATION_UNIT);
                    getControlPanel().displayedPhylogenyMightHaveChanged(false);
                }
            } else {
                for (int i = 0; i < notches; ++i) {
                    setStartingAngle((getStartingAngle() % TWO_PI) - ANGLE_ROTATION_UNIT);
                    if (getStartingAngle() < 0) {
                        setStartingAngle(TWO_PI + getStartingAngle());
                    }
                    getControlPanel().displayedPhylogenyMightHaveChanged(false);
                }
            }
        } else {
            if (notches < 0) {
                for (int i = 0; i < (-notches); ++i) {
                    getControlPanel().zoomInY(Constants.WHEEL_ZOOM_IN_FACTOR);
                    getControlPanel().displayedPhylogenyMightHaveChanged(false);
                }
            } else {
                for (int i = 0; i < notches; ++i) {
                    getControlPanel().zoomOutY(Constants.WHEEL_ZOOM_OUT_FACTOR);
                    getControlPanel().displayedPhylogenyMightHaveChanged(false);
                }
            }
        }
    } else {
        if (notches < 0) {
            for (int i = 0; i < (-notches); ++i) {
                getControlPanel().zoomInX(Constants.WHEEL_ZOOM_IN_FACTOR,
                        Constants.WHEEL_ZOOM_IN_X_CORRECTION_FACTOR);
                getControlPanel().zoomInY(Constants.WHEEL_ZOOM_IN_FACTOR);
                getControlPanel().displayedPhylogenyMightHaveChanged(false);
            }
        } else {
            for (int i = 0; i < notches; ++i) {
                getControlPanel().zoomOutY(Constants.WHEEL_ZOOM_OUT_FACTOR);
                getControlPanel().zoomOutX(Constants.WHEEL_ZOOM_OUT_FACTOR,
                        Constants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR);
                getControlPanel().displayedPhylogenyMightHaveChanged(false);
            }
        }
    }
    requestFocus();
    requestFocusInWindow();
    requestFocus();
}