Init student GUI

This commit is contained in:
GGB
2022-06-07 00:37:00 +08:00
parent 4e3b3d3669
commit 6fbac93d7c
8 changed files with 644 additions and 12 deletions

View File

@@ -1,21 +1,48 @@
package com.cfive.classroom.student;
import com.cfive.classroom.library.database.Test;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MainWindow {
public class MainWindow{
private JPanel rootPanel;
private JLabel title;
private JTextField textField1;
private JPasswordField passwordField1;
private JButton login;
static JFrame frame = new JFrame("学生登录界面");
public MainWindow() {
login.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(check()){
Center center = new Center();
center.start();
frame.setVisible(false);
}
}
});
}
public boolean check(){
String password = new String(passwordField1.getPassword());
if (textField1.getText() == null || password.length() == 0) {
JOptionPane.showMessageDialog(null, "账号密码不能为空");
return false;
} else {
return true;
}
}
public static void main(String[] args) {
JFrame frame = new JFrame("MainWindow");
frame.setContentPane(new MainWindow().rootPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
// frame.pack();
frame.setBounds(650,300,600,400);
frame.setVisible(true);
com.cfive.classroom.library.net.Test.run();
Test.run();
frame.setResizable(false);
}
}