Java第四课
自己做的界面
public class Login extends JFrame implements ActionListener{
private JLabel lname;
private JLabel lpass;
private JTextField tname;
private JTextField tpass;
private JButton login;
//事件
private void ininEvnet() {
login.addActionListener(this);
}
private void init() {
lpass=new JLabel(“学号”);
lname=new JLabel(“姓名”);
tname=new JTextField(14);
tpass=new JTextField(14);
login=new JButton(“查找”);
ininEvnet();
this.setLayout(new FlowLayout(FlowLayout.CENTER));
this.add(lname);
this.add(tname);
this.add(lpass);
this.add(tpass);
this.add(login);
this.setTitle(“查找功能”);
this.setSize(500,120);
this.setLocation(301,300);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public Login() {
init();
}
public void actionPerformed(ActionEvent e) {
System.out.println(“单击”);
}
}
Java第四课
最新推荐文章于 2022-06-16 14:06:09 发布