//Image对象,该对象用来标示你本地文件的虚拟路径
ImageIcon image;
//根据本地文件存放的位置生成Image对象,当然,可以用相对路径
image=new ImageIcon("images/ClientLogin.png或者E:/我的照片/HCCH.jpg");
//添加一个包含背景图片image的JLabel
JLabel imageLabel = new JLabel(image);
//设置该Label的大小,用以控制背景显示
imageLabel.setBounds(0,0,230,75);
//向Frame中添加该Label
this.add(imageLabel);
ImageIcon image;
//根据本地文件存放的位置生成Image对象,当然,可以用相对路径
image=new ImageIcon("images/ClientLogin.png或者E:/我的照片/HCCH.jpg");
//添加一个包含背景图片image的JLabel
JLabel imageLabel = new JLabel(image);
//设置该Label的大小,用以控制背景显示
imageLabel.setBounds(0,0,230,75);
//向Frame中添加该Label
this.add(imageLabel);