StudentGradesManageSystem
一个使用Java swing的学生成绩管理系统,软件工程实验周的数据库大作业源码下载地址希望对你有帮助
https://github.com/21503882/studentscore
作业要求如下:
学生成绩管理系统中,系统的用户是学校的学生、教师和管理员。各类用户经登录认证后方可使用系统。学生使用本系统查询自己的成绩。教师使用本系统录入和查询自己所授课程的考试成绩。教学管理员可以查询所有课程成绩,并使用本系统进行成绩的统计和生成报表。系统的基本功能包括:
用户登录:对用户身份进行认证 用户信息管理:对学生、教师和管理员等各类用户的基本信息进行管理,例如:学生信息包括:学号,姓名,年龄,性别,出生年月,地址,电话,E-mail等。
成绩录入:教师可以查询自己本学期所授课程,并录入学生的考试成绩。录入过程中,可以暂存已录入的成绩,当录入完成后提交。
成绩维护:教师在提交前,可以修改已录入或暂存的学生成绩;但提交后,则只能查询不能再进行任何修改;教学管理员可以清除教师已提交的成绩。
成绩查询:教师、教学管理员可以查询学生考试成绩。学生只允许查询自己的考试成绩,教师只允许查询自己所授课程的成绩。
成绩统计:教学管理员可以按课程、按学生、按班级、按时间等对成绩统计分析,并以较好的可视化界面显示。例如:教学管理员根据核算出的总评成绩统计处于优、良、中、及格、不及格的学生人数以及占总人数的百分比,统计平均成绩、及格率、不及格率、旷考率等。其中100-90为优,89-80为良,79-70为中,69-60为及格,60分以下为不及格。按要求输出成绩在优、良、中、及格、不及格各区间的学生学号。
TODOList:
代码重构,JDBC单例问题,也可以添加一个实现数据库连接的基类
TIP: 项目用到IDEA的GUI designer,请用IDEA运行项目,Eclipse会报错
/**
* Created by jason on 9/2/15.
*/
public class HomeAdmin {
private JPanel homeAdmin;
private JButton exitButton;
private JLabel nameLabel;
private JTabbedPane tabbedPane1;
private JTable table1;
private JTable table2;
private JButton addOneRowCourseButton;
private JButton deleteOneRowCourseButton;
private JButton addOneRowTeacherButton1;
private JButton deleteOneRowTeacherButton1;
private JButton saveCourseButton;
private JButton saveTeacherButton;
private JTable table3;
private JButton addOneStudentRowButton;
private JButton saveStudentTableButton;
private JButton deleteOneStudentRowButton;
private JTable table4;
private JButton cleanButton;
private JTable table5;
private JTable table6;
private JButton statisticButton;
private JTabbedPane tabbedPane2;
private JTable course;
private JTable studentClass;
private JTable student;
private JTable time;
private JButton updateButton;
private JComboBox comboBox1;
private JFrame frame;
private CourseModel courseModel;
private TeacherModel teacherModel;
private StudentInfoModel studentInfoModel;
private ImportedGradeModel importedGradeModel;
private CourseInfoModel courseInfoModel;
private GradeInputModel gradeInputModel;
private CourseStatisticModel courseStatisticModel;
private TimeStatisticModel timeStatisticModel;
private ClassStatisticModel classStatisticModel;
private StudentStatisticModel studentStatisticModel;
public static void main(String[] args) {
}
public HomeAdmin() {
courseModel = new CourseModel();
teacherModel = new TeacherModel();
table1.setModel(courseModel);
table2.setModel(teacherModel);
studentInfoModel = new StudentInfoModel();
table3.setModel(studentInfoModel);
importedGradeModel = new ImportedGradeModel();
table4.setModel(importedGradeModel);
courseInfoModel = new CourseInfoModel();
table5.setModel(courseInfoModel);
gradeInputModel = new GradeInputModel();
table6.setModel(gradeInputModel);
courseStatisticModel = new CourseStatisticModel();
timeStatisticModel = new TimeStatisticModel();
classStatisticModel = new ClassStatisticModel();
studentStatisticModel = new StudentStatisticModel();
// private JTable course;
// private JTable studentClass;
// private JTable student;
// private JTable time;
course.setModel(courseStatisticModel);
studentClass.setModel(classStatisticModel);
time.setModel(timeStatisticModel);
student.setModel(studentStatisticModel);
Admin admin = (Admin) Session.userInfo;
nameLabel.setText(admin.getUsername());
frame = new JFrame("HomeAdmin");
frame.setContentPane(homeAdmin);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.pack();
UICommonUtils.makeFrameToCenter(frame);
frame.setVisible(true);
addOneRowCourseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!(table2.getSelectedRow() > -1) || table2.getValueAt(table2.getSelectedRow(), 3) == null) {
JOptionPane.showMessageDialog(frame, "请在教师表中选择一项有教师姓名的行", "提示", JOptionPane.INFORMATION_MESSAGE);
return;
} else {
Map<String, Object> map = new HashMap<String, Object>();
Object id = teacherModel.getValueAt(table2.getSelectedRow(), 0);
Object name = teacherModel.getValueAt(table2.getSelectedRow(), 3);
map.put("teacherId", id);
map.put("name", name);
courseModel.addRow(map);
}
}
});
addOneRowTeacherButton1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Map<String, Object> map = new HashMap<String, Object>();
teacherModel.addRow(map);
}
});
saveTeacherButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
teacherModel.save();
}
});
saveCourseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
courseModel.save();
}
});
deleteOneRowCourseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (table1.getSelectedRow() > -1) {
courseModel.remove(table1.getSelectedRow());
} else {
JOptionPane.showMessageDialog(frame, "请选择一行", "提示