import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
public class Ahi extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel pan = null;
private JLabel users = null;
private JLabel userpassword = null;
private JTextField tfName = null;
private JPasswordField tfPass = null;
private JButton OK = null;
private JButton Cancel = null;
private JPanel back = null;
private JLabel lab = null;
private ImageIcon ii= new ImageIcon(getClass().getResource("/com/qq/image/20092792056688_2.jpg"));
public Ahi() {
super();
initialize();
}
private void initialize() {
this.setSize(400, 300);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getPan(), null);
jContentPane.setLayout(null);
jContentPane.add(lab,new Integer(Integer.MIN_VALUE));
jContentPane.add(pan);
}
return jContentPane;
}
private JPanel getPan() {
if (pan == null) {
pan = new JPanel();
pan.add(back);
pan.setLayout(null);
pan.setOpaque(false);
lab =new JLabel(ii);
lab.setBounds(new Rectangle(2, 0, 400, 281));
pan.setBounds(0, 0, 393, 264);
pan.add(lab, null);
}
return pan;
}
private JTextField getTfName() {
if (tfName == null) {
tfName = new JTextField(20);
tfName.setBounds(new Rectangle(170, 51, 150, 23));
tfName.setOpaque(false);//设置为透明
}
return tfName;
}
private JPasswordField getTfPass() {
if (tfPass == null) {
tfPass = new JPasswordField();
tfPass.setBounds(new Rectangle(170, 153, 150, 23));
tfPass.setOpaque(false);
}
return tfPass;
}
private JButton getOK() {
if (OK == null) {
OK = new JButton("登陆");
OK.setBounds(new Rectangle(94, 217, 75, 23));
OK.setOpaque(false);
}
return OK;
}
private JButton getCancel() {
if (Cancel == null) {
Cancel = new JButton("取消");
Cancel.setBounds(new Rectangle(203, 218, 75, 23));
}
return Cancel;
}
private JPanel getBack() {
if (back == null) {
back = new JPanel();
back.setLayout(null);
back.setOpaque(false);
userpassword = new JLabel("密 码");
userpassword.setBounds(new Rectangle(56, 146, 65, 27));
users = new JLabel("用 户");
users.setBounds(58, 49, 65, 27);
//back = new JPanel();
back.setBounds(new Rectangle(0, 0, 393, 264));
back.add(users, null);
back.add(userpassword, null);
back.add(getTfName(), null);
back.add(getTfPass(), null);
back.add(getOK(), null);
back.add(getCancel(), null);
back.add(lab, null);
}
return back;
}
} // @jve:decl-index=0:visual-constraint="207,-4"