title: Java JFrame pack() issue
body: <p>I am attempting to overlay images on top of a background image using the standard java utilities. See the pictures below...</p>
  
  <p>I have code that seems to create the background image (can you verify that it really works?)
  And I have created an extension of JPanel that I use to display images (the class is called ImagePanel)</p>
  
  <p>However, when the program launches, the JFrame is only showing the second image, which then gets moved around as the window is resized.</p>
  
  <p>I'd like to have the window open initially with the background image taking up the entirety of the window's space.  I'd then like to have the second image displayed on top, at the location that I specify.</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class ImageTest {
  
  
  
  
  public static void main(String[] args) {
      JFrame frame = new JFrame();
      frame.getContentPane().setLayout(null);
  
      JPanel backgroundPanel = new JPanel();
      ImageIcon backgroundImage = new ImageIcon("C:\\Documents and Settings\\Robert\\Desktop\\ClientServer\\Poker Table Art\\TableAndChairs.png");
      JLabel background = new JLabel(backgroundImage);
      background.setBounds(0, 0, backgroundImage.getIconWidth(), backgroundImage.getIconHeight());
      frame.getLayeredPane().add(background, new Integer(Integer.MIN_VALUE));
      backgroundPanel.setOpaque(false);
      frame.setContentPane(backgroundPanel);
  
      ImagePanel button = new ImagePanel("C:\\Documents and Settings\\Robert\\Desktop\\ClientServer\\Poker Table Art\\button.png");
      JPanel cardContainer = new JPanel(new FlowLayout());
  
  
      frame.getContentPane().add(cardContainer);
  
      cardContainer.add(button);
      cardContainer.setBounds(100, 600, 200, 200);
  
      frame.pack();
      frame.setVisible(true);
    }
  }
  </code></pre>
  
  <p><a href="http://img189.imageshack.us/img189/9739/image1qi.jpg" rel="nofollow noreferrer">alt text http://img189.imageshack.us/img189/9739/image1qi.jpg</a></p>
  
  <p><a href="http://img186.imageshack.us/img186/1082/image2ll.jpg" rel="nofollow noreferrer">alt text http://img186.imageshack.us/img186/1082/image2ll.jpg</a></p>