int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY);
    public void mouseReleased(MouseEvent e)    {      scrollTimer.stop();      scrollTimer.setDelay(300);      currentMouseX = e.getX();      currentMouseY = e.getY();            int value;      if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)        value = valueForXPosition(currentMouseX);      else        value = valueForYPosition(currentMouseY);      if (shouldScroll(POSITIVE_SCROLL))        scrollByBlock(POSITIVE_SCROLL);      else if (shouldScroll(NEGATIVE_SCROLL))        scrollByBlock(NEGATIVE_SCROLL);            trackHighlight = NO_HIGHLIGHT;      scrollListener.setScrollByBlock(false);      scrollbar.setValueIsAdjusting(true);      scrollbar.repaint();    }