void (MouseEvent event) { if (myScrollBar == null || !myScrollBar.isEnabled()) return; if (redispatchIfTrackNotClickable(event)) return; if (SwingUtilities.isRightMouseButton(event)) return; isValueCached = true; myCachedValue = myScrollBar.getValue(); myScrollBar.setValueIsAdjusting(true); myMouseX = event.getX(); myMouseY = event.getY(); boolean vertical = VERTICAL == myScrollBar.getOrientation(); if (isThumbContains(myMouseX, myMouseY)) { // pressed on the thumb myOffset = vertical ? (myMouseY - myThumb.bounds.y) : (myMouseX - myThumb.bounds.x); isDragging = true; } else if (isTrackContains(myMouseX, myMouseY)) { // pressed on the track if (isAbsolutePositioning(event)) { myOffset = (vertical ? myThumb.bounds.height : myThumb.bounds.width) / 2; isDragging = true; setValueFrom(event); } else { myScrollTimer.stop(); isDragging = false; if (VERTICAL == myScrollBar.getOrientation()) { int y = myThumb.bounds.isEmpty() ? myScrollBar.getHeight() / 2 : myThumb.bounds.y; isReversed = myMouseY < y; } else { int x = myThumb.bounds.isEmpty() ? myScrollBar.getWidth() / 2 : myThumb.bounds.x; isReversed = myMouseX < x; if (!myScrollBar.getComponentOrientation().isLeftToRight()) { isReversed = !isReversed; } } scroll(isReversed); startScrollTimerIfNecessary(); } } }