62,614
社区成员
发帖
与我相关
我的任务
分享
public void setBack() {
((JPanel) this.getContentPane()).setOpaque(false);
// Winter.jpg这个图片的位置要跟当前这个类是同一个包下
URL url = "当前这个类的名字".class.getResource("Winter.jpg");
ImageIcon img = new ImageIcon(url);
JLabel background = new JLabel(img);
this.getLayeredPane().add(background, new Integer(Integer.MIN_VALUE));
background.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
}