title: How to set Jframe Background Image in GroupLayout Java
body: <p>Am trying to set a background image for my frame but it does not work. I tried this link:</p>
  
  <p><a href="https://stackoverflow.com/questions/1064977/setting-background-images-in-jframe">Setting background images in JFrame</a></p>
  
  <p>The code:</p>
  
  <pre><code>setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("/Images/about.png")))));
  </code></pre>
  
  <p>I tried adding the above code to my Contentpane but it does not work.</p>
  
  <pre><code>public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  MainMenu frame = new MainMenu();
                  frame.setVisible(true);
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the frame.
   */
  public MainMenu() {
      setIconImage(Toolkit.getDefaultToolkit().getImage(MainMenu.class.getResource("/Images/bug-red.png")));
      setTitle("Automated Bug Fixing");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 712, 458);
  
              contentPane = new JPanel();
  
      //contentPane.setBackground(new Color(220, 220, 220));
      contentPane.setForeground(new Color(32, 178, 170));
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
              *setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("/Images/about.png")))));*
  </code></pre>