if (rowHeader != null) rowHeaderSize.setSize(rowHeader.getPreferredSize());
if (rowHead != null) rowHeaderSize.setSize(rowHead.getPreferredSize());
  public Dimension preferredLayoutSize(Container parent)   {    if (parent instanceof JScrollPane)      {        JScrollPane sc = (JScrollPane) parent;        synchronized (sc.getTreeLock ())          {            Dimension insetsSize = new Dimension(0,0);             Dimension viewportSize = new Dimension(0,0);             Dimension viewportInsetsSize = new Dimension(0,0);             Dimension columnHeaderSize = new Dimension(0,0);             Dimension rowHeaderSize = new Dimension(0,0);             Dimension verticalScrollBarSize = new Dimension(0,0);             Dimension horizontalScrollBarSize = new Dimension(0,0);             Insets insets = sc.getInsets();            Border viewportBorder = sc.getViewportBorder();            Insets viewportInsets = null;            if (viewportBorder != null)              viewportInsets = viewportBorder.getBorderInsets(parent);            if (insets != null)              insetsSize.setSize(insets.left + insets.right,                                 insets.top + insets.bottom);            if (viewport != null)              viewportSize.setSize(viewport.getPreferredSize());            if (columnHeader != null)              columnHeaderSize.setSize(columnHeader.getPreferredSize());                        if (rowHeader != null)              rowHeaderSize.setSize(rowHeader.getPreferredSize());            if (verticalScrollBar != null)              verticalScrollBarSize.setSize(verticalScrollBar.getPreferredSize());            if (horizontalScrollBar != null)              horizontalScrollBarSize.setSize(horizontalScrollBar.getPreferredSize());                        /*            System.err.println("widths: [vp=" + viewportSize.width +                               ", h=" + columnHeaderSize.width +                               ", sc=" + horizontalScrollBarSize.width + "]");            System.err.println("heights: [vp=" + viewportSize.height +                               ", h=" + rowHeaderSize.height +                               ", sc=" + verticalScrollBarSize.height + "]");                                */            return new Dimension(insetsSize.width                                  + viewportSize.width                                 + viewportInsetsSize.width                                 + rowHeaderSize.width                                 + verticalScrollBarSize.width,                                 insetsSize.height                                 + viewportSize.height                                 + viewportInsetsSize.height                                 + columnHeaderSize.height                                 + horizontalScrollBarSize.height);          }      }    else      {        return new Dimension(0,0);      }  }