public void mouseWheelMoved(MouseWheelEvent event) { double u = event.getWheelRotation(); //double u = event.getPreciseWheelRotation(); // JDK 1.7 only Tile tile = (Tile)event.getSource(); DRectangle vr = tile.getViewRectangle(); if (event.isShiftDown() && vr.width<1.0) { // horizontal HScrollBar hsb = _hsb[tile.getColumnIndex()]; vr.x += u*hsb.getUnitIncrement(1)*SCROLL_SCL; vr.x = max(0.0,min(1.0-vr.width,vr.x)); tile.setViewRectangle(vr); } else if (!event.isShiftDown() && vr.height<1.0) { // vertical VScrollBar vsb = _vsb[tile.getRowIndex()]; vr.y += u*vsb.getUnitIncrement(1)*SCROLL_SCL; vr.y = max(0.0,min(1.0-vr.height,vr.y)); tile.setViewRectangle(vr); } } });
public void adjustmentValueChanged(AdjustmentEvent ae) { if (_settingInternal) return; DRectangle vr = tile.getViewRectangle(); if (getOrientation()==HORIZONTAL) { vr.x = getV(); vr.width = getE(); } else { vr.y = getV(); vr.height = getE(); } tile.setViewRectangle(vr); } });
tile.setViewRectangle(vr);