

import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JPanel;
public class panel extends JComponent{
	   Image image;
	   public panel() {
		   try {
			  image=new ImageIcon("1.jpg").getImage();
		} catch (Exception e) {
			// TODO: handle exception
		}
		  
	   }
	   protected void paintComponent(Graphics g) {
		   super.paintComponent(g);
		   g.drawImage(image, 0, 0,this.getWidth(),this.getHeight(), null);
		   }
	}



/*public class panel extends JComponent{
	public panel() {
		JPanel Img1 = new JPanel(){
		   Image bgImg =null;
			@Override
			protected void paintComponent(Graphics arg0) {
				super.paintComponent(arg0);
				
				try{
					bgImg = ImageIO.read(new File("D:/Á·Ï°/1.jpg"));
				} catch (IOException e) {
					e.printStackTrace();
				}
				arg0.drawImage(bgImg, 0, 0,this.getWidth(),this.getHeight(), null);

			}
		
		};
		this.setLayout(new GridLayout(1,1));
		this.add(Img1);
	}*/
	
