
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
 
public class image extends JPanel {
 public static void main(String[] args)
 {
 }
        public void paintComponent(Graphics g){
                try {
                        Image img = ImageIO.read(new File("photo.jpg"));
                        g.drawImage(img, 0, 0, this);
                        g.drawLine(10, 10, 80, 60);

                        //Pour une image de fond
                        //g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                
        }               
}

