I have read some posts here about changing image background for JdesktopPane, but it doesn't seem to work:
I'm using netbeans so that's in the constructor:
ImageIcon icon = new ImageIcon("/gui/orange.png");
img = icon.getImage(); //this is a field Image img;
and in the init method (that also is in the constructor):
theDesktop = new javax.swing.JDesktopPane()
{
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(img, 0, 0, this);
}
I am new to this so I can't really understand what I did wrong. and I wonder when it works - as every computer may use different resolution - what would be the solution for the background to match every computer? (when the user wants the window to be the maximum size for example)
Thank you in advace!