Example usage for java.awt.event MouseWheelEvent isMetaDown

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

Introduction

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

Prototype

public boolean isMetaDown() 

Source Link

Document

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

Usage

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

/**
 * {@inheritDoc}/*from w ww.j av  a 2 s . c om*/
 */
@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);
            }
        }
    }
}