我swing了一个登陆界面,但是生成jar文件运行后,背景不能显示(功能正常)。public class Login extends JFrame {
JPanel contentPane;
JPasswordField passwordField;
public static void main(String[] args) {
Login frame = new Login();
}
public Login() {
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(600, 300, 600, 400);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
//组件
JLabel label1 = new JLabel("\u6B22\u8FCE\u767B\u9646\u7A3B\u7530\u7EFC\u5408\u79CD\u517B\u4FE1\u606F\u670D\u52A1\u7CFB\u7EDF");
label1.setForeground(Color.BLACK);
label1.setFont(new Font("微软雅黑", Font.BOLD, 30));
label1.setHorizontalAlignment(SwingConstants.CENTER);
label1.setBounds(34, 51, 511, 53);
contentPane.add(label1);
JLabel label2 = new JLabel("\u7528\u6237\u540D");
label2.setFont(new Font("宋体", Font.PLAIN, 20));
label2.setForeground(Color.BLACK);
label2.setHorizontalAlignment(SwingConstants.CENTER);
label2.setBounds(77, 136, 72, 32);
contentPane.add(label2);
JLabel label3 = new JLabel("\u5BC6\u7801");
label3.setForeground(Color.BLACK);
label3.setFont(new Font("宋体", Font.PLAIN, 20));
label3.setHorizontalAlignment(SwingConstants.CENTER);
label3.setBounds(77, 208, 72, 32);
contentPane.add(label3);
setVisible(true);
setTitle("登陆");
添加回答
举报
0/150
提交
取消