import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

class LoginCheck{
    private String name;
    private String password;
    public LoginCheck(String name,String password){
        this.name=name;
        this.password=password;
    }
    public boolean equals(){
        if("byxyby".equals(name)&&"123456".equals(password)){
            return true;
        }else{
            return false;
        }
    }
};
class ActionHandle{
    private JFrame frame=new JFrame("俱乐部学生信息管理系统");
    private JTextField name=new JTextField();//设置文本框
    private JPasswordField pass=new JPasswordField();
    private JLabel but1=new JLabel("用户名:");
    private JLabel but2=new JLabel("密   码:");
    private JButton but3=new JButton("登录");
    private JButton but4=new JButton("重置");

    public ActionHandle(){
        but3.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                if(e.getSource()==but3){
                    String sname=name.getText();
                    String spass=new String(pass.getPassword());
                    LoginCheck log=new LoginCheck(sname,spass);
                    if(log.equals()){
                        try {
                            new Menu();
                        } catch (Exception e1) {

                            e1.printStackTrace();
                        }
                        frame.setVisible(false);

                    }else{
                        JOptionPane.showMessageDialog(null, "登录失败,错误的用户名或密码!");
                    }
                }
            }
        });
        but4.addActionListener(
                new ActionListener(){
                    public void actionPerformed(ActionEvent e){
                        if(e.getSource()==but4){
                            name.setText("");
                            pass.setText("");
                        }
                    }

                });
        frame.setLayout(null);
        but1.setBounds(80, 40 , 80,30);
        name.setBounds(140,42, 120, 25);    //
        but2.setBounds(80, 80 , 80,30);
        pass.setBounds(140,82, 120, 25);
        but3.setBounds(130, 150 , 60,30);
        but4.setBounds(210, 150 , 60,30);
        frame.setSize(400,330);
        frame.setLocation(300, 200);
        frame.add(but1);
        frame.add(name);
        frame.add(pass);
        frame.add(but2);
        frame.add(but3);
        frame.add(but4);
        frame.setVisible(true);
    }
}
public class  Enter{
    public static void main(String[] args) {

        new ActionHandle();
    }
}
最近下载更多
wanglinddad  LV55 2024年5月11日
jiemomo  LV12 2023年11月2日
刘杂杂  LV1 2023年5月30日
lvdong2023  LV10 2023年5月17日
liuchang183  LV5 2023年4月15日
内心向阳  LV4 2023年3月30日
yuxuanniu6  LV1 2023年1月8日
lsglsg9  LV23 2022年11月13日
3069951725  LV2 2022年11月1日
小马亚  LV1 2022年10月28日
最近浏览更多
暂无贡献等级
WenMeng  LV9 2024年12月30日
曾多次  LV1 2024年12月8日
Tempted777 2024年12月5日
暂无贡献等级
BruceQ  LV14 2024年6月23日
hkhxhlhfhmt 2024年6月17日
暂无贡献等级
wanglinddad  LV55 2024年5月11日
fff2003  LV9 2024年1月3日
一磕小橙子  LV3 2024年1月3日
lshlsh 2023年12月25日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友