栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

大二项目总结

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

大二项目总结

package xuesheng;

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(“root”.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();
}

}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/971022.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号