Java 类java.awt.event.MouseWheelEvent 实例源码

项目:incubator-netbeans    文件:UIUtils.java   
public static void issue163946Hack(final JScrollPane scrollPane) {
    MouseWheelListener listener = new MouseWheelListener() {
        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (scrollPane.getVerticalScrollBar().isShowing()) {
                if (e.getSource() != scrollPane) {
                    e.setSource(scrollPane);
                    scrollPane.dispatchEvent(e);
                }
            } else {
                scrollPane.getParent().dispatchEvent(e);
            }
        }
    };
    scrollPane.addMouseWheelListener(listener);
    scrollPane.getViewport().getView().addMouseWheelListener(listener);
}
项目:incubator-netbeans    文件:InteractiveCanvasComponent.java   
public void mouseWheelMoved(MouseWheelEvent e) {
    // Mouse wheel zooming takes precedence over scrolling
    if (isMouseZoomingEnabled() &&
        e.getSource() == InteractiveCanvasComponent.this) return;

    // Change the ScrollBar value
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int unitsToScroll = e.getUnitsToScroll();
        int direction = unitsToScroll < 0 ? -1 : 1;
        if (unitsToScroll != 0) {
            int increment = scrollBar.getUnitIncrement(direction);
            int oldValue = scrollBar.getValue();
            int newValue = oldValue + increment * unitsToScroll;
            newValue = Math.max(Math.min(newValue, scrollBar.getMaximum() -
                    scrollBar.getVisibleAmount()), scrollBar.getMinimum());
            if (oldValue != newValue) scrollBar.setValue(newValue);
        }
    }
}
项目:AgentWorkbench    文件:GraphEnvironmentMousePlugin.java   
@Override
public void mouseWheelMoved(MouseWheelEvent me) {

    Point2D mouse = me.getPoint();
    Point2D center = this.getVisViewer().getCenter();
    int amount = me.getWheelRotation();

    if(zoomAtMouse) {
        if(amount > 0) {
            scaler.scale(this.getVisViewer(), out, mouse);
        } else if(amount < 0) {
            scaler.scale(this.getVisViewer(), in, mouse);
        }

    } else {
        if(amount > 0) {
            scaler.scale(this.getVisViewer(), out, center);
        } else if(amount < 0) {
            scaler.scale(this.getVisViewer(), in, center);
        }
        }
        me.consume();

}
项目:onprom    文件:UMLDiagramPanel.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
  if (e.isControlDown()) {
    ZoomUtility.changeZoom(e.getPreciseWheelRotation());
    //TODO position according mouse location
    JViewport viewPort = (JViewport) SwingUtilities
      .getAncestorOfClass(JViewport.class, this);
    if (viewPort != null) {
      Rectangle view = viewPort.getViewRect();
      view.x = ZoomUtility.get(e.getX());
      view.y = ZoomUtility.get(e.getY());
      this.scrollRectToVisible(view);
    }
  } else if (getParent() != null) {
    getParent().dispatchEvent(e);
  }
  repaint();
}
项目:2017-TeamEngine    文件:Jogl3Mouse.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    synchronized (lock) {
        int d = e.getWheelRotation(); 

        if (d < 0) {
            curDir = ScrollDirection.UP; 
        }
        else if (d > 0) {
            curDir = ScrollDirection.DOWN; 
        }
        else {
            curDir = ScrollDirection.NONE; 
        }
    }
}
项目:Spark    文件:Java2DFrame.java   
public final void mouseWheelMoved(MouseWheelEvent e)
{
    int notches = e.getWheelRotation();
    int button = 0;
    if (notches < 0)
    {
        button = 4;
    }
    else
    {
        button = 5;
    }

    game.gameQueue.add(new MousePressEvent(SparkEvents.E_MOUSEDOWN,
            button, e.getX(), e.getY()));
}
项目:OpenJSharp    文件:ScrollPaneWheelScroller.java   
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
项目:OpenJSharp    文件:ScrollPaneWheelScroller.java   
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
项目:brModelo    文件:Editor.java   
/**
 * Recebe o evento de MouseWheel do quadro de edição se não consumido.
 *
 * @param e
 */
public void ScrollMove(MouseWheelEvent e) {
    int x = parente.getHorizontalScrollBar().getValue();
    int y = parente.getVerticalScrollBar().getValue();
    int vpw = parente.getViewport().getWidth() - getMargem();
    int vph = parente.getViewport().getHeight() - getMargem();
    int p1 = e.getX() + getMargem() - x;
    int p2 = e.getY() + getMargem() - y;

    boolean ambos = (p2 > vph && p1 > vpw);

    p1 = vpw - (p1);
    p2 = vph - (p2);

    if (p1 < p2 || ambos) {
        parente.getVerticalScrollBar().setValue(y + 2 * e.getUnitsToScroll());
    }
    if (p2 < p1 || ambos) {
        parente.getHorizontalScrollBar().setValue(x + 2 * e.getUnitsToScroll());
    }
    e.consume();
}
项目:Tarski    文件:BasicGraphEditor.java   
/**
 * 
 */
protected void mouseWheelMoved(MouseWheelEvent e)
{
    if (e.getWheelRotation() < 0)
    {
        graphComponent.zoomIn();
    }
    else
    {
        graphComponent.zoomOut();
    }

    status(mxResources.get("scale") + ": "
            + (int) (100 * graphComponent.getGraph().getView().getScale())
            + "%");
}
项目:jdk8u-jdk    文件:ScrollPaneWheelScroller.java   
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
项目:jdk8u-jdk    文件:ScrollPaneWheelScroller.java   
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
项目:jdk8u-jdk    文件:bug7170657.java   
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
项目:openjdk-jdk10    文件:ScrollPaneWheelScroller.java   
public static int getIncrementFromAdjustable(Adjustable adj,
                                             MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
    }

    int increment = 0;

    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        increment = e.getUnitsToScroll() * adj.getUnitIncrement();
    }
    else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
        increment = adj.getBlockIncrement() * e.getWheelRotation();
    }
    return increment;
}
项目:openjdk-jdk10    文件:bug8049533.java   
public static void main(String[] args) {
    Frame frame = new Frame();
    Panel panel = new Panel();
    frame.add(panel);

    MouseWheelEvent event = new MouseWheelEvent(panel,
            0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0,
            2, // wheelRotation
            PRECISE_WHEEL_ROTATION); // preciseWheelRotation

    MouseWheelEvent convertedEvent = (MouseWheelEvent) SwingUtilities.
            convertMouseEvent(event.getComponent(), event, null);

    if (convertedEvent.getPreciseWheelRotation() != PRECISE_WHEEL_ROTATION) {
        throw new RuntimeException("PreciseWheelRotation field is not copied!");
    }
}
项目:openjdk-jdk10    文件:bug7170657.java   
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
项目:jermit    文件:SwingTerminal.java   
/**
 * Pass mouse events into the event queue.
 *
 * @param mouse mouse event received
 */
public void mouseWheelMoved(final MouseWheelEvent mouse) {
    int modifiers = mouse.getModifiersEx();
    boolean eventMouse1 = false;
    boolean eventMouse2 = false;
    boolean eventMouse3 = false;
    boolean mouseWheelUp = false;
    boolean mouseWheelDown = false;
    if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
        eventMouse1 = true;
    }
    if ((modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0) {
        eventMouse2 = true;
    }
    if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
        eventMouse3 = true;
    }
    mouse1 = eventMouse1;
    mouse2 = eventMouse2;
    mouse3 = eventMouse3;
    int x = screen.textColumn(mouse.getX());
    int y = screen.textRow(mouse.getY());
    if (mouse.getWheelRotation() > 0) {
        mouseWheelDown = true;
    }
    if (mouse.getWheelRotation() < 0) {
        mouseWheelUp = true;
    }

    TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_DOWN,
        x, y, x, y, mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown);

    synchronized (eventQueue) {
        eventQueue.add(mouseEvent);
    }
    synchronized (listener) {
        listener.notifyAll();
    }
}
项目:pdfjumbler    文件:PdfList.java   
@Override
public void mouseWheelMoved(MouseWheelEvent event) {
    if (event.isControlDown() && (getCellRenderer() instanceof PdfCellRenderer)) {
        setThumbnailSize(
            Math.max(10, getThumbnailSize() - zoomSpeed * event.getWheelRotation())
        );
    } else if (getParent() != null) {
        getParent().dispatchEvent(event);
    }
}
项目:incubator-netbeans    文件:WidgetAction.java   
/**
 * Creates a mouse wheel event.
 * @param id the event id
 * @param event the Swing event
 */
public WidgetMouseWheelEvent(long id, MouseWheelEvent event) {
    this.id = id;
    this.event = event;
    x = event.getX ();
    y = event.getY ();
}
项目:incubator-netbeans    文件:DocumentViewOp.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    DocumentViewOp op = op();
    if (op != null && scrollPane != null ) {
        op.mouseWheelMoved(e, this);
    }
}
项目:Logisim    文件:Canvas.java   
@Override
public void mouseWheelMoved(MouseWheelEvent arg0) {// zoom mouse wheel
    if (arg0.getPreciseWheelRotation() < 0) {
        proj.getFrame().getZoomControl().spinnerModel
                .setValue(proj.getFrame().getZoomControl().spinnerModel.getNextValue());
    } else if (arg0.getPreciseWheelRotation() > 0) {
        proj.getFrame().getZoomControl().spinnerModel
                .setValue(proj.getFrame().getZoomControl().spinnerModel.getPreviousValue());
    }

}
项目:incubator-netbeans    文件:InteractiveCanvasComponent.java   
public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        zoom(e.getX(), e.getY(), Math.pow(mouseZoomingFactor,
                                          -e.getUnitsToScroll()));
        repaintDirty();
    }
}
项目:incubator-netbeans    文件:ChartPanel.java   
private void setWheelScrollHandler(final JScrollBar scrollBar) {
    chart.addMouseWheelListener(new MouseWheelListener() {
        public void mouseWheelMoved(MouseWheelEvent e) {
            scroll(scrollBar, e);
        }
    });
}
项目:cuttlefish    文件:GraphMouseImpl.java   
public void mouseWheelMoved(MouseWheelEvent e) {
    double rotation = e.getWheelRotation();
    double sensitivity = 0.05;
    double zx, zy;
    double scaling = zoom > 1 ? 1 : renderer.getScaleFactor();

    zoom += rotation * sensitivity * scaling;
    zoomPos = renderer.screenToWorld(e.getPoint());
    zx = zoomPos.getX() * scaling;
    zy = zoomPos.getY() * scaling;
    zoomPos.setLocation(zx, zy);

    renderer.scale(zoom, zoomPos);
    renderer.repaint();
}
项目:incubator-netbeans    文件:ScrollAction.java   
@Override
public void mouseWheelMoved( MouseWheelEvent e ) {
    if( !isEnabled() )
        return;
    int rotation = e.getWheelRotation();
    if( (rotation < 0 && isScrollLeft)
            || (rotation > 0 && !isScrollLeft ) ) {
        int increment = getDefaultIncrement();
        increment *= Math.abs( rotation );
        scroll( increment );
        e.consume();
    }
}
项目:incubator-netbeans    文件:AbstractTabDisplayer.java   
@Override
public final void mouseWheelMoved( MouseWheelEvent e ) {
    scrollLeft.mouseWheelMoved( e );
    if( e.isConsumed() )
        return;
    scrollRight.mouseWheelMoved( e );
}
项目:incubator-netbeans    文件:ProfilerTableContainer.java   
private static void scroll(JScrollBar scroller, MouseWheelEvent event) {
    if (event.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int direction = event.getUnitsToScroll() < 0 ? -1 : 1;
        int increment = scroller.getUnitIncrement(direction);
        int amount = event.getScrollAmount();
        int oldValue = scroller.getValue();
        int newValue = oldValue + increment * amount * direction;
        if (oldValue != newValue) scroller.setValue(newValue);
        event.consume();
    }
}
项目:brModelo    文件:Diagrama.java   
public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.isControlDown()) {
        if (e.getWheelRotation() < 0) {
            getEditor().ZoomMais();
        } else {
            getEditor().ZoomMenos();
        }
        e.consume();
    }
}
项目:incubator-netbeans    文件:JCheckTree.java   
public void processMouseEvent(MouseEvent e) {
    if (e instanceof MouseWheelEvent) {
        Component target = JCheckTree.this.getParent();
        if (target == null || !(target instanceof JViewport))
            target = JCheckTree.this;
        MouseEvent mwe = SwingUtilities.convertMouseEvent(
                JCheckTree.this, (MouseWheelEvent)e, target);
        target.dispatchEvent((MouseWheelEvent)mwe);
    } else {
        super.processMouseEvent((MouseEvent)e);
    }
}
项目:incubator-netbeans    文件:JExtendedTree.java   
public void processMouseEvent(MouseEvent e) {
    if (e instanceof MouseWheelEvent) {
        Component target = JExtendedTree.this.getParent();
        if (target == null || !(target instanceof JViewport))
            target = JExtendedTree.this;
        MouseEvent mwe = SwingUtilities.convertMouseEvent(
                JExtendedTree.this, (MouseWheelEvent)e, target);
        target.dispatchEvent((MouseWheelEvent)mwe);
    } else {
        super.processMouseEvent((MouseEvent)e);
    }
}
项目:incubator-netbeans    文件:DebuggingViewComponent.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    JScrollBar scrollBar = mainScrollPane.getVerticalScrollBar();
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int totalScrollAmount = e.getUnitsToScroll() * scrollBar.getUnitIncrement();
        scrollBar.setValue(scrollBar.getValue() + totalScrollAmount);
    }
}
项目:rapidminer    文件:JEditTextArea.java   
@Override
public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {
    if (mouseWheelEvent.getScrollAmount() == 0) {
        return;
    }
    vertical.setValue(vertical.getValue() + 3 * mouseWheelEvent.getWheelRotation());
}
项目:BEAST    文件:ElectionSimulation.java   
@Override
public void mouseWheelMoved(MouseWheelEvent event) {
    if (react) {
        int amount = event.getWheelRotation();
        if (amount > 0) {
            model.setVerticalOffset(Math.min(model.getVerticalOffset() + amount * 5,
                    (model.getAmountVoters() - 1) * model.getElementHeight() * 2));
            view.update();
        } else {
            model.setVerticalOffset(Math.max(model.getVerticalOffset() + amount * 5, 0));
            view.update();
        }
    }
}
项目:jmt    文件:Convex3DGraph.java   
public void mouseWheelMoved(MouseWheelEvent evt) {
    if (enableCustomZoom) {
        int n = evt.getWheelRotation();
        zoomFactor *= ((n < 0) ? (-n * 1.1f) : (n * 0.9f));
        repaint();
    } else {
        // TODO: Add super signal
    }
}
项目:smile_1.5.0_java7    文件:PlotCanvas.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.getWheelRotation() == 0) {
        return;
    }

    for (int i = 0; i < base.dimension; i++) {
        int s = baseGrid.getAxis(i).getLinearSlices();
        double r = e.getWheelRotation() > 0 ? 1.0 / s : -1.0 / s;
        if (r > -0.5) {
            double d = (base.upperBound[i] - base.lowerBound[i]) * r;
            base.lowerBound[i] -= d;
            base.upperBound[i] += d;
        }
    }

    for (int i = 0; i < base.dimension; i++) {
        base.setPrecisionUnit(i);
    }

    base.initBaseCoord();
    graphics.projection.reset();
    baseGrid.setBase(base);

    repaint();
    e.consume();
}
项目:2D-Elliptic-Mesh-Generator    文件:PlotCanvas.java   
public void mouseWheelMoved(MouseWheelEvent e) {
      //System.out.println("PlotCanvas.mouseWheelMoved");
/*
       * System.out.println("PlotCanvas.mouseWheelMoved");
       * System.out.println(" mouseClick = [" + mouseClick[0] + " " +
       * mouseClick[1] + "]"); System.out.println(" mouseCurent = [" +
       * mouseCurent[0] + " " + mouseCurent[1] + "]");
       */
      mouseCurent[0] = e.getX();
      mouseCurent[1] = e.getY();
      e.consume();
      int[] origin;
      double[] ratio;
      // double factor = 1.5;
      //switch (ActionMode) {
      //    case ZOOM:
      if (e.getWheelRotation() == -1) {
          if (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) > .01) {
              origin = new int[]{(int) (mouseCurent[0] - getWidth() / 3/* (2*factor) */),
                                 (int) (mouseCurent[1] - getHeight() / 3/* (2*factor) */)};
              ratio = new double[]{0.666/* 1/factor, 1/factor */, 0.666};
              draw.dilate(origin, ratio);
          }
      } else {
          if (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) < 1) {
              origin = new int[]{(int) (mouseCurent[0] - getWidth() / 1.333/* (2/factor) */),
                                 (int) (mouseCurent[1] - getHeight() / 1.333/* (2/factor) */)
              };
              ratio = new double[]{1.5, 1.5 /* factor, factor */};
              draw.dilate(origin, ratio);
          } else /* (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) >= 1)*/ {
              ((AWTDrawer) draw).projection.initBaseCoordsProjection(true);
          }
      }
      repaint();
      //       break;
      //}
  }
项目:MapAnalyst    文件:DefaultMapController.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (wheelZoomEnabled) {
        int rotation = JMapViewer.zoomReverseWheel ? -e.getWheelRotation() : e.getWheelRotation();
        map.setZoom(map.getZoom() - rotation, e.getPoint());
    }
}
项目:MapAnalyst    文件:MapEventHandler.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    int rotations = e.getWheelRotation();
    Point2D.Double loc = mapComponent.userToWorldSpace(e.getPoint());
    for (int i = 0; i < Math.abs(rotations); i++) {
        if (rotations < 0) {
            mapComponent.zoomIn(loc);
        } else {
            mapComponent.zoomOut(loc);
        }
    }
}
项目:JavaGraph    文件:JGraphUI.java   
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (!isMyEvent(e)) {
        return;
    }
    if (getJGraph().getMode() == PAN_MODE) {
        int change = -e.getWheelRotation();
        getJGraph().changeScale(change);
    } else {
        getJGraph().getParent().dispatchEvent(e);
    }
}
项目:ramus    文件:PrintPreviewComponent.java   
public PrintPreviewComponent(RamusPrintable printable, int columnCount,
                             GUIFramework framework) {
    this.printable = printable;
    this.columnCount = columnCount;
    this.framework = framework;
    MouseWheelListener l = new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                if (e.getModifiers() == KeyEvent.CTRL_MASK) {
                    double r = e.getWheelRotation();
                    double zoom = getZoom() - 0.2 * r;
                    setCurrentZoom(zoom);
                } else {
                    Rectangle rect = getVisibleRect();
                    scrollRectToVisible(new Rectangle(rect.x, rect.y
                            + e.getWheelRotation() * 150, rect.width,
                            rect.height));
                }
            }
        }
    };
    this.addMouseWheelListener(l);
    layout = Options.getInteger("PREVIW_LAYOUT", PREV_LAYOUT_GRID);
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            setCurrentZoom(Options.getDouble("PREV_ZOOM", 1d));
        }
    });
    setCurrentZoom(Options.getDouble("PREV_ZOOM", 1d));
}