一直忘了给源码 (可不是我懒~
大二上学期写的,有点菜,大佬误骂..
如果对您有帮助请点赞哦~~
登录界面 Login_Interface.java
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;
public class Login_Interface extends JFrame {
private static final long serialVersionUID = 1L;
protected static String s1;
protected static String s2;
protected static String s3;
private JLabel jl1 = new JLabel("欢迎来到考试系统");
private JLabel jl2 = new JLabel("请填写下列信息");
private JLabel jl3 = new JLabel(" ");
private JLabel jl4 = new JLabel(" ");
private JLabel JLName = new JLabel("姓名:");
private JLabel JLMagic = new JLabel("专业:");
private JLabel JLClass = new JLabel("班级:");
private JTextField JTName = new JTextField(10);
private JTextField JTMagic = new JTextField(10);
private JTextField JTClass = new JTextField(10);
private JButton JB1 = new JButton("开始考试");
private JButton JB2 = new JButton("重置");
private JButton JBave = new JButton("平均分查看");
private JPanel jp1 = new JPanel();
private JPanel jp2 = new JPanel();
private JPanel jp3 = new JPanel();
private JPanel jp4 = new JPanel();
private JPanel jp5 = new JPanel();
private JPanel jp6 = new JPanel();
private JPanel jp7 = new JPanel();
private void Event() {
JB1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(JTName.getText().equals("") || JTClass.getText().equals("") || JTMagic.getText().equals("")) {
String s = "请输入完整信息";
JOptionPane.showMessageDialog(null, s,"提示",JOptionPane.ERROR_MESSAGE);
}else {
setVisible(false);
dispose();
s1 = JTName.getText();
s2 = JTClass.getText();
s3 = JTMagic.getText();
new Test_Interface();
}
}
});
JB2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JTName.setText(null);
JTMagic.setText(null);
JTClass.setText(null);
}
});
JBave.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
new Average_Score();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
}
public Login_Interface() {
this