-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathMarks.java
More file actions
117 lines (97 loc) · 3.85 KB
/
Copy pathMarks.java
File metadata and controls
117 lines (97 loc) · 3.85 KB
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
import javax.swing.*;
import java.awt.*;
import java.sql.ResultSet;
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);
getContentPane().setBackground(Color.WHITE);
setLayout(null);
//heading
JLabel heading = new JLabel("MUET");
heading.setBounds(100,10,500,25);
heading.setFont(new Font("Tahoma",Font.BOLD,20));
add(heading);
// sub heading
JLabel subheading = new JLabel("Result Of Examination 2022");
subheading.setBounds(100,50,500,20);
subheading.setFont(new Font("Tahoma",Font.BOLD,18));
add(subheading);
// roll number
JLabel lblrollno = new JLabel("Roll Number"+rollno);
lblrollno.setBounds(60,100,500,20);
lblrollno.setFont(new Font("Tahoma",Font.PLAIN,18));
add(lblrollno);
//semester
JLabel lblsemester = new JLabel();
lblsemester.setBounds(60,130,500,20);
lblsemester.setFont(new Font("Tahoma",Font.PLAIN,18));
add(lblsemester);
//subect 1
JLabel subject1= new JLabel();
subject1.setBounds(100,200,500,20);
subject1.setFont(new Font("Tahoma",Font.PLAIN,18));
add(subject1);
//subject2
JLabel subject2 = new JLabel();
subject2.setBounds(100,230,500,20);
subject2.setFont(new Font("Tahoma",Font.PLAIN,18));
add(subject2);
//subject3
JLabel subject3 = new JLabel();
subject3.setBounds(100,260,500,20);
subject3.setFont(new Font("Tahoma",Font.PLAIN,18));
add(subject3);
//subject4
JLabel subject4 = new JLabel();
subject4.setBounds(100,290,500,20);
subject4.setFont(new Font("Tahoma",Font.PLAIN,18));
add(subject4);
//subject5
JLabel subject5 = new JLabel();
subject5.setBounds(100,320,500,20);
subject5.setFont(new Font("Tahoma",Font.PLAIN,18));
add(subject5);
try{
Conn c = new Conn();
ResultSet rs1 = c.s.executeQuery("select * from subject where rollno ='"+rollno+"'");
while (rs1.next()){
subject1.setText(rs1.getString("subject1"));
subject2.setText(rs1.getString("subject2"));
subject3.setText(rs1.getString("subject3"));
subject4.setText(rs1.getString("subject4"));
subject5.setText(rs1.getString("subject5"));
}
ResultSet rs2 = c.s.executeQuery("select * from marks where rollno ='"+rollno+"'");
while (rs2.next()){
subject1.setText(subject1.getText() + "---------------" + rs2.getString("marks1"));
subject2.setText(subject2.getText() + "---------------" +rs2.getString("marks2"));
subject3.setText(subject3.getText() + "---------------" +rs2.getString("marks3"));
subject4.setText(subject4.getText()+ "---------------"+ rs2.getString("marks4"));
subject5.setText(subject5.getText()+"---------------"+ rs2.getString("marks5"));
lblsemester.setText("semester"+rs2.getString("semester"));
}
}catch (Exception e){
e.printStackTrace();
}
// cancel button
cancel = new JButton("Back");
cancel.setBounds(250,500,120,25);
cancel.setBackground(Color.BLACK);
cancel.setForeground(Color.WHITE);
cancel.addActionListener(this::actionPerformed);
cancel.setFont(new Font("Tahoma",Font.BOLD,15));
add(cancel);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
setVisible(false);
}
public static void main(String[] args) {
new Marks("");
}
}