title: How to add images in GUI using Eclipse? This code is not showing images
body: <p>Here is the code where I want to import pictures and I want to display them on Java GUI.</p>
  
  <pre><code>AddingImages(){
      setLayout(new FlowLayout());
  
      image1 = new ImageIcon(getClass().getResource("Capture1.PNG"));
  
  
      label1 = new JLabel("Image 1");
      add(label1);
  
      image2= new ImageIcon(getClass().getResource("Capture1.PNG"));
  
  
      label2 = new JLabel("Image 2");
      add(label2);
  }
  
      public static void main(String[] args){
      AddingImages ai = new AddingImages();
      ai.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      ai.setVisible(true);
      ai.pack();
      ai.setTitle("Adding Images in GUI");
  }
  }
  </code></pre>