return bounds.getSize();
Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent;  if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal;
  public Dimension getPreferredSize(JComponent c)  {    if (list.getModel().getSize() == 0)      return new Dimension(0, 0);    Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1);    return bounds.getSize();  }