-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMarks.java
109 lines (88 loc) · 3.75 KB
/
Marks.java
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
package university.management.system;
import java.awt.*;
import javax.swing.*;
import java.sql.*;
import java.awt.event.*;
public class Marks extends JFrame implements ActionListener {
String rollno;
JButton cancel;
Marks(String rollno) {
this.rollno = rollno;
setSize(500, 600);
setLocation(500, 100);
setLayout(null);
getContentPane().setBackground(Color.WHITE);
JLabel heading = new JLabel("Lahore University");
heading.setBounds(100, 10, 500, 25);
heading.setFont(new Font("Tahoma", Font.BOLD, 20));
add(heading);
JLabel subheading = new JLabel("Result of Examination 2024");
subheading.setBounds(100, 50, 500, 20);
subheading.setFont(new Font("Tahoma", Font.BOLD, 18));
add(subheading);
JLabel lblrollno = new JLabel("Roll Number " + rollno);
lblrollno.setBounds(60, 100, 500, 20);
lblrollno.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(lblrollno);
JLabel lblsemester = new JLabel();
lblsemester.setBounds(60, 130, 500, 20);
lblsemester.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(lblsemester);
JLabel sub1 = new JLabel();
sub1.setBounds(100, 200, 500, 20);
sub1.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(sub1);
JLabel sub2 = new JLabel();
sub2.setBounds(100, 230, 500, 20);
sub2.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(sub2);
JLabel sub3 = new JLabel();
sub3.setBounds(100, 260, 500, 20);
sub3.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(sub3);
JLabel sub4 = new JLabel();
sub4.setBounds(100, 290, 500, 20);
sub4.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(sub4);
JLabel sub5 = new JLabel();
sub5.setBounds(100, 320, 500, 20);
sub5.setFont(new Font("Tahoma", Font.PLAIN, 18));
add(sub5);
try {
Conn c = new Conn();
ResultSet rs1 = c.s.executeQuery("select * from subject where rollno = '"+rollno+"'");
while(rs1.next()) {
sub1.setText(rs1.getString("subject1"));
sub2.setText(rs1.getString("subject2"));
sub3.setText(rs1.getString("subject3"));
sub4.setText(rs1.getString("subject4"));
sub5.setText(rs1.getString("subject5"));
}
ResultSet rs2 = c.s.executeQuery("select * from marks where rollno = '"+rollno+"'");
while(rs2.next()) {
sub1.setText(sub1.getText() + "------------" + rs2.getString("marks1"));
sub2.setText(sub2.getText() + "------------" + rs2.getString("marks2"));
sub3.setText(sub3.getText() + "------------" + rs2.getString("marks3"));
sub4.setText(sub4.getText() + "------------" + rs2.getString("marks4"));
sub5.setText(sub5.getText() + "------------" + rs2.getString("marks5"));
lblsemester.setText("Semester " + rs2.getString("semester"));
}
} catch (Exception e) {
e.printStackTrace();
}
cancel = new JButton("Back");
cancel.setBounds(250, 500, 120, 25);
cancel.setBackground(Color.BLACK);
cancel.setForeground(Color.WHITE);
cancel.addActionListener(this);
cancel.setFont(new Font("Tahoma", Font.BOLD, 15));
add(cancel);
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
setVisible(false);
}
public static void main(String[] args) {
new Marks("");
}
}