Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1);
int nrows = Math.min(list.getVisibleRowCount(), list.getModel().getSize()); Rectangle bounds = getCellBounds(list, 0, nrows - 1);
  public Dimension getPreferredSize(JComponent c)  {    maybeUpdateLayoutState();    if (list.getModel().getSize() == 0)      return new Dimension(0, 0);    Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1);    return bounds.getSize();  }