tags:

views:

257

answers:

2

I am trying to create virtual desktop. I complete successfully.But i am not able to set background image for jdesktoppane. I want to set background image and After adding image also the desktop pane work normally.Is anyone know means just tell me Thanks

+1  A: 

From this thread at coderanch, a possible solution is to paint in the paintComponent method of your subclass of the JDesktopPane (or in your renderer for this class, which could be better).

Riduidel
Thank you so much .The example in this link works fine for me
Arivu2020
+1  A: 

You can extend JDeskTopPane class with another member as image and then in constructor set the background to that image.

    public ExtendedJDesktopPane(Image image) {
         super();
         this.image = image;
    }

  protected void paintComponent(Graphics g) {
     g.drawImage(scaledImage, 0, 0, this);
  }

EDIT: This is similar to the link provided below by Riduidel.. i just got late writing it.

Webbisshh