title: How to set Background image in JDesktopPane
body: <p>I want to set the background of the JDesktopPane (I add this <code>JDesktopPane</code> directly from the palette into the <code>JFrame</code>)</p>
  
  <p>I try to override the method  <code>public void paintComponent (Graphics g)</code> but it's not working</p>
  
  <p>Here is the code:</p>
  
  <pre><code>JDesktop p = new JDesktop();
  ImageIcon icon = new ImageIcon("images/Nénuphars6892.jpg");
  final Image img = icon.getImage();
  img.getScaledInstance(159, 207, Image.SCALE_SMOOTH);
  p.principal = new JDesktopPane() {
      @Override
      public void paintComponent(Graphics g) {
          super.paintComponent(g);
          Graphics2D g2d = (Graphics2D) g;
          g2d.drawImage(img, 0, 0, getSize().width, getSize().height, this);
      }
  };
  p.setVisible(true);
  </code></pre>