title: Got on <<error javax.imageio.IIOException: Can't read input file!>> when I tried to add an image on the background of my JPanel
body: <p>I am currently learning java and I have problem and can't find anything about it. I got an &quot;javax.imageio.IIOException: Can't read input file!&quot;
  I don't understand what I did wrong :
  this is my code :</p>
  <pre><code>public class FirstWindoww extends JFrame  {
      JTextField usernameText = new JTextField(30);
      private JPanel panel1;
      private JPanel panel2;
  
      public FirstWindoww() {
          super(&quot;FROGGER GAME&quot;);
          JFrame frame = this;
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          this.setLocationRelativeTo(null);
          this.setSize(400, 400);
          this.setLayout(new FlowLayout());
          panel1 = (JPanel) this.getContentPane();
          panel1.setBorder(BorderFactory.createEmptyBorder(30,30,10,30));
          panel1.setLayout(new FlowLayout());
          panel2 = (JPanel) this.getContentPane();
          panel1.setBackground(Color.GREEN);
          JPanel startingGame = new JPanel();
          this.setVisible(true);
          JLabel username = new JLabel(&quot;ENTER YOUR NAME&quot;);
          panel1.add(username);
          panel1.add(usernameText);
          usernameText.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
             System.out.println(&quot;Bouton cliqué !&quot;);
              }
                 });
  
          JButton start = new JButton(&quot;START&quot;);
          start.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  frame.remove(panel1);
                  frame.add(panel2);
                  frame.validate();
              }
          });
  
          panel1.add(start);
          JButton exit = new JButton(&quot;EXIT&quot;);
          exit.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
  
              }
          });
          panel1.add(exit);
          JButton help = new JButton(&quot;HELP&quot;);
          help.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
  
              }
          });
          panel1.add(help);
          try {
              // Load the background image
  
              BufferedImage img = ImageIO.read(new File(&quot;C:\\Users\\N\\Documents\\testGUI\\srce\\grenouille&quot;));
              this.setContentPane(new JLabel(new ImageIcon(img)));
          } catch (IOException exp) {
  
              exp.printStackTrace();
  
  
          }
          JLabel imageLabel = new JLabel();
          imageLabel.setIcon(new ImageIcon(&quot;C:\\Users\\N\\Documents\\testGUI\\src\\grenouille.png&quot;));
          panel1.add(imageLabel);
  
      }
  </code></pre>
  <p>Here are the error in a picture and you can see the fields on the right <a href="https://i.stack.imgur.com/YjiOM.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>Thank you for taking the time to read this. Have a very good day everyone :) !!!</p>