title: Displaying multiple JLabels on the same frame
body: <pre><code>  JFrame frame = new JFrame("Picture");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    display = new JPanel();      
  if(event.getSource().equals(birthday)){
      background = new JLabel(bday);
      display.add(background);
  
    }
    else if(event.getSource().equals(cake)){
      picture = new JLabel(pastry, SwingConstants.LEFT);
      display.add(picture);
    }
    else if(event.getSource().equals(input)){
      word = new JLabel(text);
      word.setHorizontalTextPosition(SwingConstants.RIGHT);
      word.setVerticalTextPosition(SwingConstants.CENTER);
      display.add(word);
    }
    frame.setPreferredSize (new Dimension(450, 350));
    frame.getContentPane().add(display);
    frame.pack();
    frame.setVisible(true);
  </code></pre>
  
  <p>This is part of an ActionListener class inside my standalone class. I had a comboBox/cardLayout. So when I clicked a button (cake) from one comboBox label, and another button (birthday) from another another comboxBox label, two frames appeared. I want the stuff to be on the SAME frame, but I couldn't figure out how to do so.</p>