Background settings for a JDesktopPane
Posted
by EricR
on Stack Overflow
See other posts from Stack Overflow
or by EricR
Published on 2010-05-25T15:24:58Z
Indexed on
2010/05/25
16:11 UTC
Read the original article
Hit count: 408
I'm using a self-made DesktopPaneUI for a JDesktopPane, I've written the proper methods for the class, and I'm running into trouble. When I resize the JDesktopPane, the background image doesn't resize with the frame. The image appears to be clipped at the size it was when the window initially opened. I'm giving it an image larger than the window, and I'm still having this problem.
Here's my method call inside the constructor of my desktopUI class.
super();
this.background = javax.imageio.ImageIO.read(new File(fileName));
Is there a way I can change my main class where I set the UI, or the myDesktopPaneUI class such that the background still fills the window when the JDesktopPane changes size?
setUI(new myDesktopPaneUI("media/bg.jpg"));
© Stack Overflow or respective owner