title: Java paint icon not working for background image
body: <p>I seem to be having an issue painting a background image over a JFrame. All the other icons are painted correctly, but the background image seems to be skipped. The variable backgroundImg is an ImageIcon (declared like most of my other icons) and it should be set as a background to my JFrame, where other icons will be painted on top of it. It might be the case that the Graphics function is Java does not paint over multiple icons, but i am not sure.  Here is the code:</p>
  
  <pre><code>private ImageIcon backgroundImg = new ImageIcon("image/back.PNG");
      private String name;
      private long score=0;
      private static final Dimension backgroundSz = new Dimension(1024,768);
  ...................................................
  public GamePanel()
  {
  setPreferredSize(backgroundSz);
  setBackground(Color.black);
  }
  
  public void paintComponent(Graphics g)
  {
      super.paintComponent(g);
  
      this.backgroundImg.paintIcon(this, g, backgroundImg.getIconWidth(), 
              backgroundImg.getIconHeight());
  
  
  }
  </code></pre>
  
  <p>To explain a bit further the problem: the background image is supposed to be of a star field and it is supposed to be painted over the main game panel. However, the result is everytime a black background (as set in the background color). The image size is the same as the frame size. All the other images are drawn correctly after the game starts, the only issue is the background picture. After removing most of the code which paints the other images, the background image would still not load. </p>