//标签加载
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class BackgroundFrame extends JFrame {
private ImageIcon ioc;
private JLabel label;
public BackgroundFrame(){
ioc=new ImageIcon("C:/Users/Administrator/Desktop/medal.png");
label=new JLabel(ioc);
add(label);
label.setLayout(null);
setSize(ioc.getIconWidth(),ioc.getIconHeight());
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
}
public class MainFrame {
public static void main(String[] args){
new BackgroundFrame();
}
}
//重载JPanle
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.J