hello the following is my code, but although it does not show me error and compiles, it simply does not work, I do not know if I made an error or if I put the image wrong from the beginning, because the image I have it from the download folder .
package source;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class imagen extends JFrame {
public Image imagenfondo;
public URL fondo;
public imagen(){
this.setBounds(0,0,400,400);
this.setTitle("ventana");
this.setVisible(true);
this.setLocationRelativeTo(null);
fondo = this.getClass().getResource("/source/puzle106.jpg");
imagenfondo = new ImageIcon(fondo).getImage();
Container contenedor = getContentPane();
contenedor.add(panel);
}
public JPanel panel= new JPanel(){
public void paintComponent(Graphics g){
g.drawImage(imagenfondo, 0,0, getWidth(), getHeight(), this);
}
};
public static void main(String [] args){
// Principal ventana = new Principl();
}
}