title: Using ImageIcon to access a picture, can't access it, how to fix?
body: <p>I am using ImageIcon to access a photo I have cropped. I put all the cropped pictures in a pic source folder in side the project. Yet when I try to use this.getClass().getResource("image 2.png") to find the image 2.png photo, the code couldn't find it. Is there anyway to fix this, do I have to re upload all the picture into a different folder? </p>
  
  <p>the "image 2.png" is inside the pic source folder, which is within the folder of the project Alle, according to the navigator panel on the right. (I am using eclipse) </p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.awt.*;
  import java.io.File;
  import java.io.IOException;
  
  import javax.swing.*;
  
  public class alle extends JFrame {
  
       JButton button1, button2;
       JLabel Label1, Label2;
       ImageIcon Icon1;
       ImageIcon Icon2;
  
      public alle() {
           setLayout(new GridLayout(2,3)); //create a gridwolrd like thing that's like 2 row, 3 column
           button1 = new JButton("set");
           add(button1);
           Label1 = new JLabel(" button");
           add(Label1);
           Icon1 = new ImageIcon(this.getClass().getResource("/alle/pic/image 2.png")) ;
           JLabel p = new JLabel(Icon1);
           add(p);
      }
  
      public static void main (String arg[]) {
          alle adfc = new alle();
          adfc.setResizable(false);
          adfc.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          adfc.setVisible(true);
          adfc.pack();
          File f = new File ("/alle/pic/image 2.png");
          System.out.print(f.exists());}}
  </code></pre>