title: Components are invisible in JFrame
body: <p>Could you tell me please, why components like JPanel etc. are not visible when added to a JFrame? Here is my code:</p>
  
  <pre><code>public class GUI{
  static JPanel panel = new JPanel();
  private void createAndShowGUI()  {
  
      final ImageIcon zielonaikona = new ImageIcon("kulazielona.png");
      JFrame frame1 = new JFrame("MasterMind");
      JRadioButton zielony = new JRadioButton(zielonaikona);
      zielony.setSelected(true);
      frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      JButton akceptuj = new JButton("Akceptuj");
  
      akceptuj.addActionListener(new ActionListener() {
  
          public void actionPerformed(ActionEvent e)
          {
              JLabel label2 = new JLabel(zielonaikona);            
              panel.add(label2);
          }
      });      
  
  
      BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
      panel.add(akceptuj);
      panel.setLayout(layout);
      panel.add(zielony);
      JLabel label = new JLabel (zielonaikona); 
      panel.add(label);
      frame1.getContentPane().add(panel);
      frame1.getContentPane().add(akceptuj);
      frame1.getContentPane().add(zielony);
      frame1.setSize(200, 300);
      frame1.setVisible(true);
  
  }
  
  public static void main(String[] args) {
  
      GUI kk = new GUI();
      kk.createAndShowGUI();
  }
  }
  </code></pre>