Dimension bup = buttonPanel.getPreferredSize(); Dimension fl = fileList.getPreferredSize(); return new Dimension((tp.width + bp.width + bup.width + fl.width), (tp.height + bp.height + bup.height + fl.height));
Dimension fl = fileListPanel.getPreferredSize(); return new Dimension(fl.width, tp.height + bp.height + fl.height);
  public Dimension getPreferredSize(JComponent c)  {    Dimension tp = topPanel.getPreferredSize();    Dimension bp = bottomPanel.getPreferredSize();    Dimension bup = buttonPanel.getPreferredSize();    Dimension fl = fileList.getPreferredSize();    return new Dimension((tp.width +        bp.width + bup.width + fl.width),         (tp.height + bp.height +         bup.height + fl.height));  }