scroll(bar, delta);
scroll(bar, wheel > 0 ? delta : -delta);
    public void mouseWheelMoved(MouseWheelEvent e)    {      if (scrollpane.getViewport().getComponentCount() == 0)        return;      Component target = scrollpane.getViewport().getComponent(0);      JScrollBar bar = scrollpane.getVerticalScrollBar();      Scrollable scrollable = (target instanceof Scrollable) ? (Scrollable) target                                                            : null;      boolean tracksHeight = scrollable != null                             && scrollable.getScrollableTracksViewportHeight();      int wheel = e.getWheelRotation() * ROWS_PER_WHEEL_CLICK;      int delta;      // If possible, scroll vertically.      if (bar != null && ! tracksHeight)        {          if (scrollable != null)            {              bounds(target);              delta = scrollable.getScrollableUnitIncrement(                rect, SwingConstants.VERTICAL, wheel);            }          else            {              // Scroll non scrollables.              delta = wheel * SCROLL_NON_SCROLLABLES;            }          scroll(bar, delta);        }      // If not, try to scroll horizontally      else        {          bar = scrollpane.getHorizontalScrollBar();          boolean tracksWidth = scrollable != null                                && scrollable.getScrollableTracksViewportWidth();          if (bar != null && ! tracksWidth)            {              if (scrollable != null)                {                  bounds(target);                  delta = scrollable.getScrollableUnitIncrement(                     rect, SwingConstants.HORIZONTAL, wheel);                }              else                {                  // Scroll non scrollables.                  delta = wheel * SCROLL_NON_SCROLLABLES;                }              scroll(bar, delta);            }        }    }