title: JPanel size by inner components
body: <p>Is it possible to tell JPanel to set its size to fit all components that it contains? Something like <code>pack()</code> for JFrame.</p>
  
  <p>edit: The trick with preferredSize didn't help. I've got JSplitPane, where in one part there is GridBagLayout with many labels (see screenshot) and labels overlap each other.</p>
  
  <p><a href="http://foto.darth.cz/pictures/screen.png">screenshot http://foto.darth.cz/pictures/screen.png</a></p>