/** * @see MouseEvent */ public boolean isControlDown () { return event.isControlDown (); }
jZoomPanel.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { if(e.isControlDown()) { // TODO implement zoom } else { JPanel panel = (JPanel) me.getSource(); MouseEvent newMe = SwingUtilities.convertMouseEvent(panel, me, jsc); jsc.dispatchEvent(me); } } });
/** * @see MouseEvent */ public boolean isControlDown () { return event.isControlDown (); }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isControlDown()) { if (e.getWheelRotation() < 0) { System.out.println("Zoom-in when scrolling up"); } else { System.out.println("Zoom-out when scrolling down"); } } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isControlDown()) { if (e.getWheelRotation() < 0) { System.out.println("mouse wheel Up"); } else { System.out.println("mouse wheel Down"); } } else { // pass the event on to the scroll pane getParent().dispatchEvent(e); } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isControlDown()) { double notches = -e.getWheelRotation(); mandelbrotZoom *= Math.pow(1.1, notches); } else { super.mouseWheelMoved(e); } }
@Override public void mouseWheelMoved( final MouseWheelEvent event ) { // Rotating up returns negative for ( int change = event.getWheelRotation(), dir = change < 0 ? 1 : -1; change != 0; change += dir ) if ( event.isControlDown() ) { // Change gravity final int delta = gravity + dir <= 10 ? 1 : gravity + dir <= 100 ? 10 : gravity + dir <= 500 ? 50 : 100; gravity += dir * delta; gravity = Math.max( 1, Math.min( 1000, gravity ) ); // Normalize } else { // Change number of stars int count = starList.size(); final int delta = count + dir <= 100 ? 10 : count + dir <= 200 ? 20 : count + dir <= 500 ? 50 : count + dir <= 1000 ? 100 : 200; count += delta * dir; count = Math.max( 10, Math.min( 5000, count ) ); // Normalize while ( count < starList.size() ) starList.remove( starList.size() - 1 ); while ( count > starList.size() ) starList.add( new Star() ); } } };
private void jScrollPane1MouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_jScrollPane1MouseWheelMoved // if ccontrol is down then do a zoom event if (evt.isControlDown()) { try { int r = evt.getWheelRotation(); r = r * SPINNER_ZOOM_SIZE * -1; externalZoomBy(r); } catch (ClassCastException e) { jSpinnerZoom.setBackground(Color.PINK); } } }//GEN-LAST:event_jScrollPane1MouseWheelMoved
@Override public void mouseWheelMoved( final MouseWheelEvent event ) { if ( event.isControlDown() ) { final int newZoomIdx = zoomComboBox.getSelectedIndex() - event.getWheelRotation(); zoomComboBox.setSelectedIndex( Math.max( 0, Math.min( zoomComboBox.getItemCount() - 1, newZoomIdx ) ) ); // An event will be fired which will cause reconfigureZoom() to be called... } } } );
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isControlDown()) { // This method handles zooming-in and zooming-out the images of // the parse-trees. // the new zoom ratio is proportional to the number of wheel clicks double newZoomRatio = masterZoomRatio - e.getWheelRotation()*MOUSE_WHEEL_SENSITIVITY_COEFICIENT; setNewImageZoomRatio(newZoomRatio); e.consume(); } }
/** * Move the sliders in rsponse to the mouse wheel */ public void mouseWheelMoved(MouseWheelEvent e) { Object src = e.getSource(); ctrlKeyDown = e.isControlDown(); int notches = e.getWheelRotation(); if (src == brightnessSlider) { brightnessSlider .setValue(brightnessSlider.getValue() - 2 * notches); } else if (src == saturationSlider) { saturationSlider .setValue(saturationSlider.getValue() + 2 * notches); } else if (src == imagePicker) { setHue(getHue() + 2 * notches); } ctrlKeyDown = false; }
/** * Move the sliders in rsponse to the mouse wheel */ @Override public void mouseWheelMoved(MouseWheelEvent e) { Object src = e.getSource(); ctrlKeyDown = e.isControlDown(); int notches = e.getWheelRotation(); if (src == brightnessSlider) { brightnessSlider .setValue(brightnessSlider.getValue() - 2 * notches); } else if (src == saturationSlider) { saturationSlider .setValue(saturationSlider.getValue() + 2 * notches); } else if (src == imagePicker) { setHue(getHue() + 2 * notches); } ctrlKeyDown = false; }
private void addMouseWheelZoomingSupport() { addMouseWheelListener(e -> { if (e.isControlDown()) { if (e.getWheelRotation() < 0) { // up, away from the user // this.view will be always the active image this.view.increaseZoom(); } else { // down, towards the user this.view.decreaseZoom(); } } }); }
@Override public void mouseWheelMoved(MouseWheelEvent e) { double notches = e.getWheelRotation() / 1.5; if (e.isControlDown()) { notches /= 10; } if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { setCameraDistance(getCameraDistance() + notches); } }
public void mouseWheelMoved(final MouseWheelEvent _e) { if (_e.isControlDown()) { rotateY(_e.getWheelRotation() < 0 ? -getRotateAngle() : getRotateAngle()); } else if (_e.isShiftDown()) { translateX(_e.getWheelRotation() < 0 ? -2 : 2); } else { translateY(_e.getWheelRotation() < 0 ? -2 : 2); } }
@Override public void mouseWheelMoved(final MouseWheelEvent e) { if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown()) { int change = -e.getWheelRotation(); changeFontSizeBy(change); e.consume(); } } });
public void mouseWheelMoved(final MouseWheelEvent e) { try { if (e.isShiftDown()) { if (e.getWheelRotation() > 0) stepslice(false); else if (e.getWheelRotation() < 0) stepslice(true); if (Toolbar.getToolId() == Toolbar.POINT && mode == MOVE) moveobject(); } else if (e.isControlDown()) { if (e.getWheelRotation() > 0) stepchannel(false); else if (e.getWheelRotation() < 0) stepchannel(true); } else { if (e.getWheelRotation() > 0) steptime(false); else if (e.getWheelRotation() < 0) steptime(true); } } catch (Throwable x) { mtrackj.catcher().uncaughtException(Thread.currentThread(),x); } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isShiftDown()) { return; } Viewport viewport = layerCanvas.getViewport(); int wheelRotation = e.getWheelRotation(); double oldZoomFactor = viewport.getZoomFactor(); double newZoomFactor = oldZoomFactor * Math.pow(1.1, wheelRotation); viewport.setZoomFactor(newZoomFactor); }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isShiftDown()) { return; } Viewport viewport = layerCanvas.getViewport(); int wheelRotation = e.getWheelRotation(); if (invertZooming) { wheelRotation *= -1; } double oldZoomFactor = viewport.getZoomFactor(); double newZoomFactor = oldZoomFactor * Math.pow(1.1, wheelRotation); viewport.setZoomFactor(newZoomFactor); }
private void addListeners() { addMouseListener(this); addMouseMotionListener(this); addMouseWheelListener(e -> { if (e.isControlDown()) { if (e.getWheelRotation() < 0) { // up, away from the user increaseZoom(e.getPoint()); } else { // down, towards the user decreaseZoom(e.getPoint()); } } }); }