Dimension retVal = getPreferredSize(); if (getLayoutOrientation() == VERTICAL)
int prefWidth, prefHeight; if (fixedCellWidth != -1) prefWidth = fixedCellWidth; else { prefWidth = 0; int size = getModel().getSize(); for (int i = 0; i < size; i++) if (getCellBounds(i, i).width > prefWidth) prefWidth = getCellBounds(i, i).width; }  if (getModel().getSize() == 0 && fixedCellWidth == -1) return new Dimension(256, 16 * getVisibleRowCount()); else if (getModel().getSize() == 0) return new Dimension (fixedCellWidth, 16 * getVisibleRowCount());  if (fixedCellHeight != -1) prefHeight = fixedCellHeight; else
  public Dimension getPreferredScrollableViewportSize()  {    Dimension retVal = getPreferredSize();    if (getLayoutOrientation() == VERTICAL)      {        if (fixedCellHeight != -1)          {            if (fixedCellWidth != -1)          {                int size = getModel().getSize();                retVal = new Dimension(fixedCellWidth, size * fixedCellHeight);              } // TODO: add else clause (preferredSize is ok for now)          } // TODO: add else clause (preferredSize is ok for now)      }    return retVal;  }