开发者

is it possible to add background image to jdesktop pane

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 nor开发者_开发技巧mally.Is anyone know means just tell me Thanks


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜