int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0;  Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y;
int row = getClosestRowForLocation(0, visibleRect.y); if (row != -1) { Rectangle b = getRowBounds(row); if (b.y != visibleRect.y) { if (direction < 0) delta = Math.max(0, visibleRect.y - b.y); else delta = b.y + b.height - visibleRect.height;
  public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation,                                        int direction)  {    int delta;    // Round so that the top would start from the row boundary    if (orientation == SwingConstants.VERTICAL)      {        // One pixel down, otherwise picks another row too high.        int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1);        row = row + direction;        if (row < 0)          row = 0;        Rectangle newTop = getRowBounds(row);        delta = newTop.y - visibleRect.y;      }    else      delta = direction * rowHeight == 0 ? 20 : rowHeight;    return delta;  }