Example usage for java.awt.event MouseWheelEvent isControlDown

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

Introduction

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

Prototype

public boolean isControlDown() 

Source Link

Document

Returns whether or not the Control 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);/*from   w w w .  ja  va2  s .  c  o m*/
            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();
}

From source file:processing.app.EditorTab.java

public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.isControlDown()) {
        if (e.getWheelRotation() < 0) {
            editor.base.handleFontSizeChange(1);
        } else {/*from  w ww .  jav  a  2s .  c  o m*/
            editor.base.handleFontSizeChange(-1);
        }
    } else {
        e.getComponent().getParent().dispatchEvent(e);
    }
}

From source file:savant.view.swing.GraphPane.java

/**
 * {@inheritDoc}//from  ww  w.j a v  a  2 s . c o  m
 */
@Override
public void mouseWheelMoved(MouseWheelEvent e) {

    int notches = e.getWheelRotation();
    LocationController lc = LocationController.getInstance();

    if (MiscUtils.MAC && e.isMetaDown() || e.isControlDown()) {
        if (notches < 0) {
            lc.shiftRangeLeft();
        } else {
            lc.shiftRangeRight();
        }
    } else {
        if (InterfaceSettings.doesWheelZoom()) {
            if (notches < 0) {
                lc.zoomInOnMouse();
            } else {
                lc.zoomOutFromMouse();
            }
        } else {
            JScrollBar sb = getVerticalScrollBar();
            if (sb.isVisible()) {
                sb.setValue(sb.getValue() + notches * 15);
            }
        }
    }
}

From source file:view.WorkspacePanel.java

/**
 * Creates new form MiddlePanel/* w  w w. j  a  v  a 2  s  . com*/
 */
public WorkspacePanel() {
    initComponents();
    if (Bundle.getBundle().getCurrentLocale() == null) {
        Bundle.getBundle().setCurrentLocale(Bundle.Locales.English);
    }
    updateText();
    status = Status.READY;
    cl = (CardLayout) this.rightPanel.getLayout();
    topToolbar.setVisible(false);
    bottomToolbar.setVisible(false);
    rightPanel.setVisible(false);
    clSign.setVisible(false);
    rightPanel.setBackground(Color.WHITE);
    lblText.setVisible(false);
    jScrollPane1.setVisible(false);
    btnChangeAppearance.setVisible(false);
    add(jMenuBar1, BorderLayout.NORTH);
    ToolTipManager.sharedInstance().registerComponent(jtValidation);
    jSplitPane1.setDividerSize(0);
    cbVisibleSignature.setSelected(true);
    lblRevision.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    clearSignatureFields();
    jsImagePanel.addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.isControlDown()) {
                e.consume();
                if (e.getWheelRotation() < 0) {
                    zoomIn();
                } else {
                    zoomOut();
                }
                fixTempSignaturePosition(true);
            }
        }
    });
}