——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于java的Swing学生教务选课成绩管理系统(java+mysql+swing)
启动类:Login.java
管理员:
admin 123456
老师:
1 123456
2 123456
3 123456
学生:
10004 123456
10015 123456
10016 123456
10017 123456
10019 123456
10020 123456
10021 123456
10022 123456
管理员:学生、教师、课程、年级、班级、选课录入与总览、成绩录入与统计
老师:选课录入与总览、成绩录入与统计
学生:选课录入与总览(成绩查看)
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| List<StudentModel> lists = new ArrayList<StudentModel>(); String sql = "select * from c_student where class_id="+class_id; ResultSet rs = DBConnection.query(sql); try { while(rs.next()){ StudentModel sm = new StudentModel(); sm.setStu_id(rs.getInt("stu_id")); sm.setStu_name(rs.getString("stu_name")); sm.setStu_sex(rs.getString("stu_sex")); sm.setClass_id(rs.getInt("class_id")); sm.setStu_password(rs.getString("stu_password")); lists.add(sm); } rs.close(); } catch (SQLException e) { e.printStackTrace(); } return lists; }
public String getStudentNameById(int stu_id){ String stu_name=""; String sql = "select stu_name from c_student where stu_id="+stu_id; ResultSet rs = DBConnection.query(sql); try { if(rs.next()){ stu_name=rs.getString("stu_name"); } rs.close();
} catch (SQLException e) { e.printStackTrace(); } return stu_name; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| }
public class CCourseMarkStatistic extends JDialog {
private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JLabel jLabel = null; private JLabel jLabel3 = null; private JComboBox jComboBox_course = null; private JLabel jLabel4 = null; private JLabel jLabel_course_max = null; private JLabel jLabel5 = null; private JLabel jLabel_course_min = null; private JLabel jLabel6 = null; private JLabel jLabel_course_avg = null; private JLabel jLabel7 = null; private JLabel jLabel_course_good = null; private JLabel jLabel8 = null; private JLabel jLabel_course_ok = null; private JLabel jLabel_course_counts = null; private JLabel jLabel10 = null; private JLabel jLabel11 = null;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| } catch (SQLException e) { e.printStackTrace(); } return lists; }
public String getStudentNameById(int stu_id){ String stu_name=""; String sql = "select stu_name from c_student where stu_id="+stu_id; ResultSet rs = DBConnection.query(sql); try { if(rs.next()){ stu_name=rs.getString("stu_name"); } rs.close();
} catch (SQLException e) { e.printStackTrace(); } return stu_name; }
public boolean deleteListByStuId(int stu_id){ String sql = "delete from c_student where stu_id="+stu_id; return (DBConnection.update(sql)==true)?true:false; }
public boolean addStudent(String stu_name,String stu_sex,int class_id){ String sql="insert into c_student(stu_name,stu_sex,class_id) values('"+stu_name+"','"+stu_sex+"',"+class_id+")"; return (DBConnection.update(sql)==true)?true:false; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| jComboBox_query_condition.setEnabled(false); } else { jComboBox_query_condition.setEnabled(true); }
}
}
}
private JCheckBox getJCheckBox_teach_filter() { if (jCheckBox_teach_filter == null) { jCheckBox_teach_filter = new JCheckBox(); jCheckBox_teach_filter.setBounds(new Rectangle(265, 22, 23, 22)); } return jCheckBox_teach_filter; }
private JCheckBox getJCheckBox_fuzzy_query() { if (jCheckBox_fuzzy_query == null) { jCheckBox_fuzzy_query = new JCheckBox(); jCheckBox_fuzzy_query.setBounds(new Rectangle(424, 59, 120, 22)); jCheckBox_fuzzy_query.setText("是否全表模糊"); } return jCheckBox_fuzzy_query; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| jTable.setModel(model); jTable.getSelectionModel().setSelectionInterval(0, 0); }
public class tableListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { if (jTable.getSelectedRow() != -1) { int rows = jTable.getSelectedRow(); jLabel3.setText(jTable.getValueAt(rows, 1) .toString()); jTextArea.setText(jTable.getValueAt(rows, 2) .toString()); } } }
public class btnListener implements ActionListener { public void actionPerformed(ActionEvent e) { if(e.getSource()==jButton_empty){ Object[] options = { "确认", "取消" }; if(JOptionPane.showOptionDialog(null, "警告,重要日志删除,你确定要删除吗?", "删除警告", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0])==JOptionPane.OK_OPTION) { String sql = "truncate table c_log"; DBConnection.update(sql); }else return; } } }
}
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=171925461606201sx
https://javayms.pages.dev?id=171925461606201sx