public void mouseWheelMoved(MouseWheelEvent e) { String st[] = {"PER UNITA'", "PER BLOCCO"}; int unit = e.getUnitsToScroll(); // calcolo per la scrollbar verticale l'attuale posizione // e l'unità di incremento per scroll JScrollBar sb = sp.getVerticalScrollBar(); int y = sb.getValue(); int y1 = e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL ? sb.getUnitIncrement(1) : sb.getBlockIncrement(1); sb.setValue(y + y1 * unit); // aggiorna la view della textarea int a = e.getScrollAmount(); int b = e.getScrollType(); int c = e.getUnitsToScroll(); int d = e.getWheelRotation(); double f = e.getPreciseWheelRotation(); String g = "Unità da scorrere per giro di tacca: " + a + "\nTipo di scroll: " + st[e.getScrollType()] + "\nUnità che scorreranno verso l'alto: " + c + "\nNumero di tacche ruotate: " + d + "\nNumero di tacche precisamente ruotate: " + f; wheel_area.setText(g); }
public void mouseWheelMoved(MouseWheelEvent e) { if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { dragX = e.getX(); dragY = e.getY(); if (e.isShiftDown()) { tmpDragX = dragX - e.getUnitsToScroll(); tmpDragY = dragY; } else { tmpDragX = dragX; tmpDragY = dragY - e.getUnitsToScroll(); } movingMap(tmpDragX, tmpDragY); } }
/* * (non-Javadoc) * * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent) */ public void mouseWheelMoved(MouseWheelEvent e) { if (e.getSource() == jsVolume) { int iOld = jsVolume.getValue(); int iNew = iOld - (e.getUnitsToScroll() * 3); jsVolume.setValue(iNew); } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { if (e.getUnitsToScroll() > 0) { cminx -= dist * 0.1f; cminy -= dist * 0.1f; cmaxx += dist * 0.1f; cmaxy += dist * 0.1f; dcminx -= ddist * 0.1; dcminy -= ddist * 0.1; dcmaxx += ddist * 0.1; dcmaxy += ddist * 0.1; } else { cminx += dist * 0.1f; cminy += dist * 0.1f; cmaxx -= dist * 0.1f; cmaxy -= dist * 0.1f; dcminx += ddist * 0.1; dcminy += ddist * 0.1; dcmaxx -= ddist * 0.1; dcmaxy -= ddist * 0.1; } dist = (cmaxx - cminx); ddist = (dcmaxx - dcminx); } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { Camera c = Camera.main(); if (c.debug()) { c.setVerticalSize(c.getVerticalSize() + e.getUnitsToScroll() * 0.05f); } }
private static int getScrollAmount(Component c, MouseWheelEvent me, JScrollBar scrollBar) { final int scrollBarWidth = scrollBar.getWidth(); final int ratio = Registry.is("ide.smart.horizontal.scrolling") && scrollBarWidth > 0 ? Math.max((int) Math.pow(c.getWidth() / scrollBarWidth, 2), 10) : 10; // do annoying scrolling faster if smart scrolling is on return me.getUnitsToScroll() * scrollBar.getUnitIncrement() * ratio; }
@Override public final void mouseWheelMoved(final MouseWheelEvent e) { scroll.pos(scroll.pos() + e.getUnitsToScroll() * 20); rend.repaint(); }