if (getUI().locationToIndex(this, r.getLocation()) == -1 && indexToLocation(getModel().getSize() - 1).y < r.y) return getModel().getSize() - 1;
  public int getLastVisibleIndex()  {    ComponentOrientation or = getComponentOrientation();    Rectangle r = getVisibleRect();    r.translate(0, (int) r.getHeight() - 1);    if (or == ComponentOrientation.LEFT_TO_RIGHT)      r.translate((int) r.getWidth() - 1, 0);    return getUI().locationToIndex(this, r.getLocation());        }