基于java的Swing+MySQL教务学生选课考勤成绩管理系统(java+swing+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

321223072409

331223072409

341223072409

361223072409

371223072409

381223072409

391223072409

401223072409

基于java的Swing+MySQL教务学生选课考勤成绩管理系统(java+swing+mysql)

启动类:LoginFrm

管理员:
admin 123456

教师:
老王 123456
老李 123456

学生:
小张 123456
小王 123456
二狗 123456

学生可以选课、签到
老师可以打成绩

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


public class LoginFrm extends JFrame {

private JPanel contentPane;
private JTextField userNameTextField;
private JPasswordField passwordTextField;
private JComboBox userTypeComboBox;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginFrm frame = new LoginFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
*/
public LoginFrm() {
setTitle("\u767B\u9646\u754C\u9762");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
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
51
52
	 */
// public static void main(String[] args) {
// EventQueue.invokeLater(new Runnable() {
// public void run() {
// try {
// EditPasswordFrm frame = new EditPasswordFrm();
// frame.setVisible(true);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
// }

/**
* Create the frame.
*/
public EditPasswordFrm() {
setTitle("\u4FEE\u6539\u5BC6\u7801");
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
setClosable(true);
setIconifiable(true);
JLabel label = new JLabel("\u539F\u5BC6\u7801\uFF1A");
label.setIcon(new ImageIcon(EditPasswordFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/password.png")));
label.setFont(new Font("微软雅黑", Font.PLAIN, 14));

oldPasswordTextField = new JPasswordField();
oldPasswordTextField.setColumns(10);

JLabel label_1 = new JLabel("\u65B0\u5BC6\u7801\uFF1A");
label_1.setIcon(new ImageIcon(EditPasswordFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u4FEE\u6539\u5BC6\u7801.png")));
label_1.setFont(new Font("微软雅黑", Font.PLAIN, 14));

newPasswordTextField = new JPasswordField();
newPasswordTextField.setColumns(10);

JLabel label_2 = new JLabel("\u786E\u8BA4\u5BC6\u7801\uFF1A");
label_2.setIcon(new ImageIcon(EditPasswordFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u4FEE\u6539\u5BC6\u7801.png")));
label_2.setFont(new Font("微软雅黑", Font.PLAIN, 14));

confirmPasswordTextField = new JPasswordField();
confirmPasswordTextField.setColumns(10);

JButton submitButton = new JButton("\u786E\u8BA4");
submitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
submitEdit(e);
}
});
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
			JOptionPane.showMessageDialog(this, "选课成功,课程信息更新失败!");
}
}else{
JOptionPane.showMessageDialog(this, "选课失败!");
}
courseDao.closeDao();
scDao.closeDao();
initTable();
}

private void setStudentCombox(){
StudentDao studentDao = new StudentDao();
studentList = studentDao.getStudentList(new Student());
studentDao.closeDao();
for (Student student : studentList) {
searchStudentComboBox.addItem(student);
editSelectedStudentComboBox.addItem(student);
}
if("学生".equals(MainFrm.userType.getName())){
Student user = (Student) MainFrm.userObject;
for(int i = 0; i < searchStudentComboBox.getItemCount();i++){
Student student = (Student) searchStudentComboBox.getItemAt(i);
if(student.getId() == user.getId()){
searchStudentComboBox.setSelectedIndex(i);
editSelectedStudentComboBox.setSelectedIndex(i);
break;
}
}
}
}
private void setCourseCombox(){
CourseDao courseDao = new CourseDao();
courseList = courseDao.getCourseList(new Course());
courseDao.closeDao();
for (Course course : courseList) {
searchCourseComboBox.addItem(course);
editSelectedCourseComboBox.addItem(course);
}
}
private void getSelectedCourse(SelectedCourse selectedCourse){
SelectedCourseDao selectedCourseDao = new SelectedCourseDao();
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
51
52
53
					.addGap(65)
.addComponent(searchButton))
.addGroup(groupLayout.createSequentialGroup()
.addGap(79)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(viewPanel, GroupLayout.PREFERRED_SIZE, 585, GroupLayout.PREFERRED_SIZE)
.addComponent(panel_1, 0, 0, Short.MAX_VALUE))))
.addContainerGap(85, Short.MAX_VALUE))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(53)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label)
.addComponent(courseComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(searchButton))
.addGap(39)
.addComponent(viewPanel, GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
.addGap(18)
.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE)
.addGap(33))
);

JButton defaultViewButton = new JButton("\u9ED8\u8BA4\u663E\u793A");
defaultViewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
defaultViewAct(ae);
}
});
defaultViewButton.setIcon(new ImageIcon(StatsScoreFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u9ED8\u8BA4.png")));
defaultViewButton.setFont(new Font("微软雅黑", Font.PLAIN, 14));

JButton barViewButton = new JButton("\u67F1\u72B6\u56FE\u663E\u793A");
barViewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
barViewAct(ae);
}
});
barViewButton.setIcon(new ImageIcon(StatsScoreFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u67F1\u72B6\u56FE.png")));
barViewButton.setFont(new Font("微软雅黑", Font.PLAIN, 14));

JButton pieViewButton = new JButton("\u997C\u72B6\u56FE\u663E\u793A");
pieViewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
peiViewAct(ae);
}
});
pieViewButton.setIcon(new ImageIcon(StatsScoreFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u997C\u72B6\u56FE.png")));
pieViewButton.setFont(new Font("微软雅黑", Font.PLAIN, 14));
GroupLayout gl_panel_1 = new GroupLayout(panel_1);
gl_panel_1.setHorizontalGroup(
gl_panel_1.createParallelGroup(Alignment.LEADING)
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
			try {
ManageScoreFrm frame = new ManageScoreFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
*/
public ManageScoreFrm() {
setClosable(true);
setIconifiable(true);
setTitle("\u6210\u7EE9\u7BA1\u7406\u754C\u9762");
setBounds(100, 100, 791, 618);

JLabel label = new JLabel("\u5B66\u751F\uFF1A");
label.setIcon(new ImageIcon(ManageScoreFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u5B66\u751F\u7BA1\u7406.png")));
label.setFont(new Font("微软雅黑", Font.PLAIN, 14));

studentComboBox = new JComboBox();

JLabel label_1 = new JLabel("\u8BFE\u7A0B");
label_1.setIcon(new ImageIcon(ManageScoreFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u8BFE\u7A0B.png")));
label_1.setFont(new Font("微软雅黑", Font.PLAIN, 14));

courseComboBox = new JComboBox();
courseComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ie) {
courseChangedAct(ie);
}
});

JButton searchButton = new JButton("\u67E5\u8BE2");
searchButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Student student = (Student)studentComboBox.getSelectedItem();
Course course = (Course)courseComboBox.getSelectedItem();
Score score = new Score();
score.setStudent_id(student.getId());
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
resetButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
resetValue(ae);
}
});
resetButton.setIcon(new ImageIcon(AddStudentFrm.class.getResourcehttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/\u91CD\u7F6E.png")));
resetButton.setFont(new Font("微软雅黑", Font.PLAIN, 14));
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(91)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_2)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(studentPasswordField, GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(studentClassComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(studentNameTextField, GroupLayout.PREFERRED_SIZE, 151, GroupLayout.PREFERRED_SIZE)))
.addGap(92))
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(resetButton)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_3)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(studentSexManRadioButton)
.addGap(10)
.addComponent(studentSexFemalRadioButton)
.addGap(10)
.addComponent(studentSexUnkonwRadioButton)))
.addContainerGap())))
.addGroup(groupLayout.createSequentialGroup()
.addGap(132)
.addComponent(submitButton)
.addContainerGap(221, Short.MAX_VALUE))


项目链接:
https://javayms.github.io?id=311223072409201fy
https://javayms.pages.dev?id=311223072409201fy