JFrame:
frame = new JFrame();
frame.setUndecorated(true);//没有边框
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImageIcon img = new ImageIcon("img/login.jpg");
JLabel imgLabel = new JLabel(img);
frame.getLayeredPane().add(imgLabel, new Integer(Integer.MIN_VALUE));
imgLabel.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
frame.setSize(1280, 800);
frame.setVisible(true);
ContentPane:
Container cp = frame.getContentPane();
((JPanel) cp).setOpaque(false);
cp.add([i]Jpanel[/i]);
JPanel:
JPanel login_panel = new JPanel();
login_panel.setOpaque(false);
login_panel.setBounds(675, 118, 311, 216);
login_panel.setLayout(null);
login_panel.add([i]password[/i]);
JButton :
JButton login_button = new JButton("登陆");
login_button.setFont(new Font("微软雅黑", Font.BOLD, 14));
login_button.setBounds(10, 132, 63, 36);
login_button.setBackground(new Color(240,255,255));
login_panel.add(login_button);