title: How do I draw an image to a JPanel or JFrame?
body: <p>How do I draw an Image to a JPanel or JFrame, I have already read oracle's tutorial on this but I can't seem to get it right. I need the image "<code>BeachRoad.png</code>" to be displayed on a specific set of coordinates. Here is what I have so far.</p>
  
  <pre><code>public class Level1  extends JFrame implements ActionListener {
  
  static JLayeredPane EverythingButPlayer;
  static Level1 l1;
  
  public Level1() {
      EverythingButPlayer = new JLayeredPane();
  
      BufferedImage img = null;
      try {
          img = ImageIO.read(new File("BeachRoad.png"));
      } catch (IOException e) {
      }
      Graphics g = img.getGraphics();
      g.drawImage(img,0, 0, EverythingButPlayer);
  
  
      this.add(EverythingButPlayer);
  }
  </code></pre>
  
  <p>And in the Main(),</p>
  
  <pre class="lang-java prettyprint-override"><code>l1 = new Level1();
  l1.setTitle("poop");
  l1.setSize(1920, 1080);
  l1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  l1.setVisible(true);
  </code></pre>
  
  <p>Thanks in advance!</p>