Olá pessoal, tenho uma aplicação Java Swing e estava tentando implemantar um background no meu jdesktoppane, após conseguir deparei com algum problema ao chamar o meu internalFrame ele não aparece na tela, alguem poderia me ajudar
// meu jframe menu.
public class menu extends javax.swing.JFrame {
/**
* Creates new form menu
*/
private JDesktopPane desktopPane;
public menu() {
initComponents();
desktopPane = new BackgroundedDesktopPane();
setContentPane(desktopPane);
}
abaixo a minha classe BackgroundedDesktopPane
class BackgroundedDesktopPane extends JDesktopPane {
Image img;
public BackgroundedDesktopPane() {
try {
img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource("imagem1.jpg"), "imagem1.jpg"));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Não foi possível inserir a imagem\n" + e.getMessage(), "Erro", 0);
}
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (img != null) {
g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
} else {
g.drawString("Imagem não encontrada", 50, 50);
}
}
}
Desde já muito obrigado!