Java course design is based on C/S end student score management system

Java curriculum design chose the student achievement management system, in this record to do their own curriculum design some ideas and problems.

File source at:

github:https://github.com/feeling-cold/java-information-system

gitee:https://gitee.com/feeling-cool/java-information-system

I decided to use IDEA to write Java programs. At first, I thought I would use file system to manage data. I thought the operation of file system would be easier to start compared with the operation of database. But after reading the instructions, I found that I had to use a database, which can also act as a server for storing data. So that’s going to correspond to the problem set. The database is chosen to do the class Settings are used in MySQL, MySQL itself is relatively easy to install, I found online tutorials to install it.

After installing the database, of course, the first step is to create a new project, but we need to connect the database this time, so we need to connect IDEA with the database. This step took me some time, because AFTER I connected the database with IDEA, I found that I could not perform the operation of adding, deleting, checking and changing the database, so I checked some data. I am roughly sure that I did not import the JAR package of Connect J. I need to download the JAR package of Connect J from the official website and import the JAR package into IDEA. Following the method found on the Internet, IMPORT the JAR package into IDEA and try again to see if I can add, delete, check and modify the established table. So far, the most basic set of course is the core of the database of the operation can determine how to write.

Studentinfo1 studentInfo1 studentInfo1 (name char (10),no int, Python int, Java int,db int) Python scores, Java scores, database scores table.

When the class starts, the first class will write the right class for database operations.

Mysql > insert into studentInfo1; mysql > insert into studentInfo1; mysql > insert into studentInfo1; Insert into studentinfo1 values (xx, xx, xx,…..) If you just insert one row of data, you can write the data you want to add to the value behind the parentheses, but we need many different rows of data, so we wrap this insert function into a function. When we insert, we call the function, pass different arguments to the function, and insert multiple different rows of data. Because I’m building studentInfo1, I’m using (name char (10),no int, Python int, Java int,db int), so I need to insert a value of that type. So the wrapper function is to set the format of the formal parameters to String A,int B,int C,int D,int E, and insert these parameters into the position of the placeholder in order, we have completed the most important part of the insert function, so that when the function is called, we only need to pass in different parameters, we can insert different data. Finally, upload the SQL statement to the database.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class dbopra {
public void insert(String a,int b,int c,int d,int e ) throws Exception{
//Connection conn = null;
PreparedStatement ps = null;
Class.forName("com.mysql.jdbc.Driver");
String jdbc = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8";
Connection conn = DriverManager.getConnection(jdbc, "root", "root");
String sql = "INSERT INTO studentinfo1 (name,no,python,java,db) VALUES (?,?,?,?,? )";
ps = conn.prepareStatement(sql);
ps.setString(1, a);
ps.setInt(2, b);
ps.setInt(3, c);
ps.setInt(4, d);
ps.setInt(5, e);
int insertCount = ps.executeUpdate();
}

The second thing to write is to delete the data, this is also the same reason, of course, I am based on the student id delete information, so only set an int parameter on the line.

1
2
3
4
5
6
7
8
9
10
public void delete(int b) throws Exception{
PreparedStatement ps = null;
Class.forName("com.mysql.jdbc.Driver");
String jdbc = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8";
Connection conn = DriverManager.getConnection(jdbc, "root", "root");
String sql = "delete from studentinfo1 where no = ?";
ps = conn.prepareStatement(sql);
ps.setInt(1,b);
int insertCount = ps.executeUpdate();
conn.close();}

The third to write is the query data, again the same reason, of course, I am still based on the student number query information, so parameter only set an int on the line. But before the data query and the difference is the information that we need to return the query, so you need to by the return value, we need to put the query after setting a good container, at the same time I hope on the basis of student id, can return to give me a name, three grades of data types, and get String function to get the value of the database are type String, So it’s just a good idea to put these values in an array, just do it, go through all the rows in the database, and when the student number is equal to the parameter that you passed in, put that row in the array, and then the query is done.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public String[] select(int aa) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
String jdbc="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8";
Connection conn=DriverManager.getConnection(jdbc, "root", "root");
Statement state=conn.createStatement();
String sql="select * from studentinfo1";
ResultSet rs=state.executeQuery(sql);
String[] arrey = new String[5];
//int i = 0;
while(rs.next()){
if (Integer.parseInt(rs.getString(2) )== aa)
{
arrey[0] = rs.getString(1);
arrey[1] = rs.getString(2);
arrey[2] = rs.getString(3);
arrey[3] = rs.getString(4);
arrey[4] = rs.getString(5);
System.out.print(rs.getString(1)+" "+rs.getString(3)+" "+rs.getString(4)+" "+rs.getString(5));
break;
}
}
conn.close();
}

Finally, to complete the last modification operation, which I still change the value of the data according to the student number, my first thought is to set the placeholder to “set? =? Where no =?” After the actual operation, the modification operation cannot be realized. After checking the data, I do not know why it cannot be operated, but WHEN I was debugging before, I used “set name =? Where no =?””Set python =? Where no =?” I then changed the idea to use an if statement, as shown below

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 void update(String a,int b,int c) throws Exception{
PreparedStatement ps = null;
Class.forName("com.mysql.jdbc.Driver");
String jdbc = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8";
Connection conn = DriverManager.getConnection(jdbc, "root", "root");
if (a.equals("python"))
{
String sql = "update studentinfo1 set python = ? where no = ? ";
ps = conn.prepareStatement(sql);
ps.setInt(1, b);
ps.setInt(2, c);
int insertCount = ps.executeUpdate();
}
else if(a.equals("java"))
{
String sql = "update studentinfo1 set java = ? where no = ? ";
ps = conn.prepareStatement(sql);
ps.setInt(1, b);
ps.setInt(2, c);
int insertCount = ps.executeUpdate();
}
else if(a.equals("db"))
{
String sql = "update studentinfo1 set db = ? where no = ? ";
ps = conn.prepareStatement(sql);
ps.setInt(1, b);
ps.setInt(2, c);
int insertCount = ps.executeUpdate();
}
conn.close();
}

This also indirectly implements the modification function, but requires an additional operation to change the name because of data type limitations.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public void updatename(String a,String b,int c) throws  Exception{
PreparedStatement ps = null;
Class.forName("com.mysql.jdbc.Driver");
String jdbc = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8";
Connection conn = DriverManager.getConnection(jdbc, "root", "root");
if (a.equals("姓名"))
{
String sql = "update studentinfo1 set name = ? where no = ? ";
ps = conn.prepareStatement(sql);
ps.setString(1, b);
ps.setInt(2, c);
int insertCount = ps.executeUpdate();
}
conn.close();
}

The core of the database to add and delete check and change the operation is finished, then began to write the “front end”, first write the initial interface of each system ———— login interface.

Import our most commonly used Swing components and AWT, and the writing of the GUI begins.

Set the familiar components JTextfield, JButton, JLabel, JPasswordfield to fill it, first set the window center, and window ban maximization.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class run extends JFrame{
final JTextField t1 = new JTextField(20);
final JTextField t2 = new JTextField(20);
final JPasswordField t3 = new JPasswordField(20);
int input = 6;
public void init(){
setSize(580,400);
setTitle("成绩管理系统");
setDefaultCloseOperation(3);
setResizable(false);
setLocationRelativeTo(null);

JLabel l1 = new JLabel("身份:");
//t1 = new JTextField(20);

JLabel l2 = new JLabel("姓名:");
//JTextField t2 = new JTextField(20);

JLabel l3 = new JLabel("密码:");
//JTextField t3 = new JTextField(20);
//t3.setEchoChar('*');

JButton b1 = new JButton("确定");

Next, add event listeners for the buttons, and add event listeners for the register and login buttons. Click Register to store information in loguser. TXT. When storing loguser. TXT, I use the contents obtained from the text box in the form of “identity, username, password” to store the file line by line. Loguser. TXT file, judge whether the content of the text box is equal one by one, if you can find the same data, you can login successfully, login successfully can enter the corresponding interface, that is, instantiate classes such as student. Of course, in the design of the system, we default six login opportunities, if the login failed for six times, it will automatically exit the system.

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int aa = 0 ;
FileReader fr = new FileReader("E://loguser.txt");
BufferedReader br = new BufferedReader(fr);
List<String>list = new ArrayList();
String a = br.readLine();
while (a !=null)
{
list.add(a);
a = br.readLine();
} for (int i = 0; i < list.size(); i++) {

String el = list.get(i);
//System.out.print(el);
//System.out.print(run.this.t2.getText()+String.valueOf(run.this.t3.getPassword()));
if (el.equals(run.this.t1.getText() + "," + run.this.t2.getText() + "," + String.valueOf(run.this.t3.getPassword())))
{

run.this.dispose();

if (run.this.t1.getText().equals("教师")) {

new teacher();

}
else if (run.this.t1.getText().equals("学生")) {
new student();
}
else if (run.this.t1.getText().equals("教师端管理员"))
{
new adteacher();
}
else if (run.this.t1.getText().equals("学生端管理员"))
{
new adstudent();
}
break;
}
if (!(el.equals(run.this.t1.getText() + "," + run.this.t2.getText() + "," + String.valueOf(run.this.t3.getPassword()))))
{
aa += 1;

if (aa == list.size())
{

run.this.input -= 1;
JDialog d = new JDialog();
d.setSize(100, 100);
JOptionPane.showMessageDialog(d, "登录失败!你还有"+input+"次机会", "登陆提示", ERROR_MESSAGE);
}
}

}
if (input == 0)
{
run.this.dispose();
System.exit(0);
}
}catch(Exception e1) {}
}
});
JButton b2 = new JButton("注册");
b2.setOpaque(false);
b2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
String[] arr ={};
FileWriter fw = new FileWriter("E://loguser.txt",true);
fw.write(run.this.t1.getText());
fw.write(",");
fw.write(run.this.t2.getText());
fw.write(",");
fw.write(run.this.t3.getText());
fw.write("\r\n");
fw.close();
JDialog d = new JDialog();
d.setSize(100, 100);
JOptionPane.showMessageDialog(d, "注册成功", "注册提示",JOptionPane.PLAIN_MESSAGE);
}catch(Exception e1){}
}
});

​ That’s it for the login screen and functionality. All that’s left to do is add components to the panel and add background images to the window. Just find a picture on the Internet. Below is the code snippet for the entire interface and functionality. Of course, I set the login screen as the main class of the entire class, and the rest of the classes are instantiated in the main class.

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
public void init(){
setSize(580,400);
setTitle("成绩管理系统");
setDefaultCloseOperation(3);
setResizable(false);
setLocationRelativeTo(null);
JLabel l1 = new JLabel("身份:");
//t1 = new JTextField(20);

JLabel l2 = new JLabel("姓名:");
//JTextField t2 = new JTextField(20);

JLabel l3 = new JLabel("密码:");
//JTextField t3 = new JTextField(20);
//t3.setEchoChar('*');

JButton b1 = new JButton("确定");
b1.setOpaque(false);

b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int aa = 0 ;
FileReader fr = new FileReader("E://loguser.txt");
BufferedReader br = new BufferedReader(fr);
List<String>list = new ArrayList();
String a = br.readLine();
while (a !=null)
{
list.add(a);
a = br.readLine();
}
/*System.out.println(list.size());
System.out.println(list.get(0));
System.out.println(list.get(1));
System.out.println(list.get(2));
System.out.println(list.get(3));*/

for (int i = 0; i < list.size(); i++) {

String el = list.get(i);
//System.out.print(el);
//System.out.print(run.this.t2.getText()+String.valueOf(run.this.t3.getPassword()));
if (el.equals(run.this.t1.getText() + "," + run.this.t2.getText() + "," + String.valueOf(run.this.t3.getPassword())))
{
//System.out.print("ok");
run.this.dispose();
//new student();
if (run.this.t1.getText().equals("教师")) {

new teacher();

}
else if (run.this.t1.getText().equals("学生")) {
new student();
}
else if (run.this.t1.getText().equals("教师端管理员"))
{
new adteacher();
}
else if (run.this.t1.getText().equals("学生端管理员"))
{
new adstudent();
}
break;
}
if (!(el.equals(run.this.t1.getText() + "," + run.this.t2.getText() + "," + String.valueOf(run.this.t3.getPassword()))))
{
aa += 1;
//System.out.println(aa);
if (aa == list.size())
{
//System.out.print(aa);
run.this.input -= 1;
JDialog d = new JDialog();
d.setSize(100, 100);
JOptionPane.showMessageDialog(d, "登录失败!你还有"+input+"次机会", "登陆提示", ERROR_MESSAGE);
}
}

}

//JDialog d = new JDialog();
//d.setSize(100, 100);
//JOptionPane.showMessageDialog(d, "登录失败!你还有"+input+"次机会", "登陆提示", ERROR_MESSAGE);
if (input == 0)
{
run.this.dispose();
System.exit(0);
}
}catch(Exception e1) {}
}
});
JButton b2 = new JButton("注册");
b2.setOpaque(false);
b2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
String[] arr ={};
FileWriter fw = new FileWriter("E://loguser.txt",true);
fw.write(run.this.t1.getText());
fw.write(",");
fw.write(run.this.t2.getText());
fw.write(",");
fw.write(run.this.t3.getText());
fw.write("\r\n");
fw.close();
JDialog d = new JDialog();
d.setSize(100, 100);
JOptionPane.showMessageDialog(d, "注册成功", "注册提示",JOptionPane.PLAIN_MESSAGE);
}catch(Exception e1){}
}
});
JLayeredPane pa = new JLayeredPane();
JPanel p1 = new JPanel();
ImageIcon image = new ImageIcon("E://2.jpg");
JLabel ji = new JLabel(image);
p1 = (JPanel)getContentPane();
p1.add(ji);
l1.setBounds(100, 120, 30, 30);
t1.setBounds(150,120,200,30);
l2.setBounds(100, 170, 30, 30);
t2.setBounds(150,170,200,30);
l3.setBounds(100, 220, 30, 30);
t3.setBounds(150,220,200,30);
b1.setBounds(150,270,60,30);
b2.setBounds(290,270,60,30);
pa.add(p1,JLayeredPane.DEFAULT_LAYER);
pa.add(l1, JLayeredPane.MODAL_LAYER);
pa.add(l2, JLayeredPane.MODAL_LAYER);
pa.add(l3, JLayeredPane.MODAL_LAYER);
pa.add(t1, JLayeredPane.MODAL_LAYER);
pa.add(t2, JLayeredPane.MODAL_LAYER);
pa.add(t3, JLayeredPane.MODAL_LAYER);
pa.add(b1, JLayeredPane.MODAL_LAYER);
pa.add(b2, JLayeredPane.MODAL_LAYER);
setLayeredPane(pa);
setVisible(true);

}
public run()
{
init();
}
public static void main(String[] args)
{
new run();
}
}

Next we need to write the classes we want to instantiate student.class and teacher.class. It still inherits the JFrame interface. Using the teacher.class example, it is still necessary to add an event listener to the component. By the component to monitor whether the occurrence of events, in the corresponding corresponding operations. For the store button, all we need to do is instantiate dbopra, call insert, and store the data to the database. You can insert the data you entered in the text box by taking the text entered in the text box as an argument to the insert function. Query, delete are the same reason, just pass in different parameters.

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
class teacher extends JFrame{
final JTextField t1 = new JTextField(20);
final JTextField t2 = new JTextField(20);
final JTextField t3 = new JTextField(20);
final JTextField t4 = new JTextField(20);
final JTextField t5 = new JTextField(20);
public teacher()
{
init();
}
public void init()
{
setSize(580,400);
setTitle("教师端");
setDefaultCloseOperation(3);
setResizable(false);
setLocationRelativeTo(null);
//setLayout(new GridLayout(6,1)); JLabel l2 = new JLabel("学号");
//t1 = new JTextField(20);

JLabel l1 = new JLabel("姓名");
//JTextField t2 = new JTextField(20);

JLabel l3 = new JLabel("python");

JLabel l4 = new JLabel("java");

JLabel l5 = new JLabel("数据库");

JButton b1 = new JButton("存储");
b1.setOpaque(false);
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try{
dbopra tdp = new dbopra();
String a = "insert into studentinfo1 values "+"("+teacher.this.t1.getText()+","+teacher.this.t2.getText()+","+teacher.this.t3.getText()+","+teacher.this.t4.getText()+","+teacher.this.t5.getText()+")";
System.out.print(a);
tdp.insert(teacher.this.t1.getText(),Integer.parseInt(teacher.this.t2.getText()),Integer.parseInt(teacher.this.t3.getText()),Integer.parseInt(teacher.this.t4.getText()),Integer.parseInt(teacher.this.t5.getText()));
JDialog d = new JDialog();
d.setSize(100,100);
JOptionPane.showMessageDialog(d,"已存入数据库","存储提示",JOptionPane.PLAIN_MESSAGE);
}catch(Exception e1){}
}
});

JButton b3 = new JButton("修改");
b3.setOpaque(false);
b3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
teacher.this.dispose();
new teacherup();
}
});

JButton b4 = new JButton("删除");
b4.setOpaque(false);
b4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
dbopra tdp = new dbopra();
tdp.delete(Integer.parseInt(teacher.this.t2.getText()));
JDialog d = new JDialog();
d.setSize(100,100);
JOptionPane.showMessageDialog(d, "删除成功", "删除提示",JOptionPane.PLAIN_MESSAGE);
}catch (Exception e1){}
}
});

JButton b2 = new JButton("查询");
b2.setOpaque(false);
b2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
//System.out.print("ok");
dbopra tdp = new dbopra();
//System.out.print("1ok");
//tdp.select(Integer.parseInt(teacher.this.t2.getText()));
String []a = tdp.select(Integer.parseInt(teacher.this.t2.getText()));
//System.out.print(a[0]);
//System.out.print(a[1]);
t1.setText(a[0]);
t2.setText(a[1]);
t3.setText(a[2]);
t4.setText(a[3]);
t5.setText(a[4]);
} catch (Exception e1) {}
}
});

JLayeredPane pa = new JLayeredPane();
JPanel p1 = new JPanel();
ImageIcon image = new ImageIcon("E://3.jpg");
JLabel jl = new JLabel(image);
p1 = (JPanel)getContentPane();
p1.add(jl);

l1.setBounds(150, 40, 30, 30);
t1.setBounds(200, 40, 220, 30);
l2.setBounds(150, 90, 30, 30);
t2.setBounds(200, 90, 220, 30);
l3.setBounds(150, 140, 60, 30);
t3.setBounds(200, 140, 220, 30);
l4.setBounds(150, 190, 30, 30);
t4.setBounds(200, 190, 220, 30);
l5.setBounds(150, 240, 60, 30);
t5.setBounds(200, 240, 220, 30);
b1.setBounds(180, 290, 60, 30);
b2.setBounds(250, 290, 60, 30);
b3.setBounds(320, 290, 60, 30);
b4.setBounds(390, 290, 60, 30);
pa.add(p1, JLayeredPane.DEFAULT_LAYER);
pa.add(l1, JLayeredPane.MODAL_LAYER);
pa.add(l2, JLayeredPane.MODAL_LAYER);
pa.add(l3, JLayeredPane.MODAL_LAYER);
pa.add(l4, JLayeredPane.MODAL_LAYER);
pa.add(l5, JLayeredPane.MODAL_LAYER);
pa.add(t1, JLayeredPane.MODAL_LAYER);
pa.add(t2, JLayeredPane.MODAL_LAYER);
pa.add(t3, JLayeredPane.MODAL_LAYER);
pa.add(t4, JLayeredPane.MODAL_LAYER);
pa.add(t5, JLayeredPane.MODAL_LAYER);
pa.add(b1, JLayeredPane.MODAL_LAYER);
pa.add(b2, JLayeredPane.MODAL_LAYER);
pa.add(b3, JLayeredPane.MODAL_LAYER);
pa.add(b4, JLayeredPane.MODAL_LAYER);
setLayeredPane(pa);
setVisible(true);
}

}

For the modification action, I wrote an action to modify the panel, which is done by Teacherup.class. If you click Modify on the teacherup.clas interface, you can instantiate Teacherup. clas and jump out of the modify interface. To complete the modification operation. Below are the renderings.

Teacherup. class implements the modify panel.

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class teacherup extends JFrame{
final JTextField t1 = new JTextField(20);
final JTextField t2 = new JTextField(20);
final JTextField t3 = new JTextField(20);
public teacherup()
{
init();
}
public void init()
{
setSize(580,400);
setTitle("修改面板");
setResizable(false);
setLocationRelativeTo(null);
//setLayout(new GridLayout(4,1));

JLabel l1 = new JLabel("学号");
JLabel l2 = new JLabel("项目");
JLabel l3 = new JLabel("结果");
JButton b1 =new JButton("确定");
b1.setOpaque(false);
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
dbopra tdp = new dbopra();
if ((teacherup.this.t2.getText()).equals("姓名"))
{
tdp.updatename(teacherup.this.t2.getText(), teacherup.this.t3.getText(), Integer.parseInt(teacherup.this.t1.getText()));
}
else {
tdp.update(teacherup.this.t2.getText(), Integer.parseInt(teacherup.this.t3.getText()), Integer.parseInt(teacherup.this.t1.getText()));
}
JDialog d = new JDialog();
d.setSize(100,100);
JOptionPane.showMessageDialog(d,"修改成功","修改提示",JOptionPane.PLAIN_MESSAGE);
teacherup.this.dispose();
new teacher();
}catch(Exception e1){}
}
});

JLayeredPane pa = new JLayeredPane();
JPanel p = new JPanel();
ImageIcon image = new ImageIcon("E://3.jpg");
JLabel jl = new JLabel(image);
p = (JPanel)getContentPane();
p.add(jl);

l1.setBounds(150, 60, 30, 30);
t1.setBounds(200, 60, 200, 30);
l2.setBounds(150, 140, 30, 30);
t2.setBounds(200, 140, 200, 30);
l3.setBounds(150, 220, 30, 30);
t3.setBounds(200, 220, 200, 30);
b1.setBounds(260, 300, 60, 30);

pa.add(p, JLayeredPane.DEFAULT_LAYER);
pa.add(l1, JLayeredPane.MODAL_LAYER);
pa.add(l2, JLayeredPane.MODAL_LAYER);
pa.add(l3, JLayeredPane.MODAL_LAYER);

pa.add(t1, JLayeredPane.MODAL_LAYER);
pa.add(t2, JLayeredPane.MODAL_LAYER);
pa.add(t3, JLayeredPane.MODAL_LAYER);

pa.add(b1, JLayeredPane.MODAL_LAYER);

setLayeredPane(pa);
​ setVisible(true);
​ }

}

So basically finished, the student side and the teacher side basically no difference, is to reduce the modification, storage, delete permissions, only have query function, I will not put the code, you can delete according to the teacher side.

Wrote it. The basic system is already in place. Teachers have the function of adding, deleting, checking and changing, and students have the function of querying. If you need to add some analysis functions of results, you can add them by yourself.

I’ll leave it there for now. Vegetable chicken 1, if there is a mistake, hope to correct.


Java course design is based on C/S end student score management system
http://example.com/2021/07/02/Java-se/
Author
feeling-cold
Posted on
July 2, 2021
Licensed under