2 Star 0 Fork 0

Ryeoyeong/数据库课程设计

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SystemStudentPanel.java 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
Ryeoyeong 提交于 2023-06-28 06:37 . 完善功能的学生端1.0
package sqltest;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SystemStudentPanel extends JPanel implements ActionListener {
private JLabel sno = null;
private JLabel password = null;
private JTextField getSno = null;
private JPasswordField getPassword = null;
private JButton loginButton = null;
public String inputSno;
String inputPassword;
Redis redis=null;
public SystemStudentPanel() {
sno = new JLabel("学号:");
getSno = new JTextField(null, 8);
password = new JLabel("登陆密码:");
getPassword = new JPasswordField(null, 8);
loginButton = new JButton("登录");
loginButton.addActionListener(this);
add(sno);
add(password);
add(getSno);
add(getPassword);
add(loginButton);
setVisible(true);
}
public boolean login(String sno, String password) {
Connector connector = new Connector();
if (password.equals(connector.getDBPassword(sno))) {
return true;
} else {
return false;
}
}
public void actionPerformed(ActionEvent e) {
redis=new Redis();
inputSno = getSno.getText();
inputPassword = new String(getPassword.getPassword());
redis.delSno();
if (login(inputSno, inputPassword)==true && e.getSource() == loginButton) {
redis.setRedis(inputSno,inputPassword);
redis.setSno(inputSno);
JOptionPane.showMessageDialog(this, "登陆成功!", "提示", JOptionPane.PLAIN_MESSAGE);
new StudentSelectFrame();
} else if(login(inputSno, inputPassword)==false && e.getSource() == loginButton) {
JOptionPane.showMessageDialog(this, "学号或登录密码输入错误!请重新输入!", "提示", JOptionPane.WARNING_MESSAGE);
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ryeoyeong/database-course-design.git
git@gitee.com:ryeoyeong/database-course-design.git
ryeoyeong
database-course-design
数据库课程设计
master

搜索帮助