title: How set location of an image in a JFrame
body: <p>I'm trying to set the the location of an image in a JFrame.  I thought <strong>label.setLocation(100, 100);</strong> would set the location of the image to 100, 100 (top left corner), but it doesn't seem to do anything no matter were I put it.  I even tried panal.setLocation(100, 100).  Both do nothing, I get <strong>no errors</strong> and the <strong>image does appears</strong> but at 0, 0.  What am I doning wrong?  Here's my code:</p>
  
  <pre><code>import javax.swing.*;  
  
  public class DisplayImage {  
      public DisplayImage() {  
          JFrame frame = new JFrame("Display Image");  
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
  
          JPanel panel = (JPanel)frame.getContentPane();  
  
          JLabel label = new JLabel();  
          label.setIcon(new ImageIcon("src/img/school.png"));
          label.setLocation(100, 100);
          panel.add(label);  
  
          frame.setLocationRelativeTo(null);  
          frame.pack();  
          frame.setVisible(true);  
      }  
  
      public static void main (String args[]) {  
          SwingUtilities.invokeLater(new Runnable() {  
              public void run() {  
                  new DisplayImage();  
              }  
          });  
      }  
  }  
  </code></pre>