-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathStudent_portal.java
221 lines (206 loc) · 7.27 KB
/
Student_portal.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
package forms;
import java.awt.Color;
import java.awt.Font;
import javax.swing.*;
import java.sql.*;
import java.awt.event.*;
import java.util.GregorianCalendar;
import java.util.Calendar;
public class StudentPortal extends JFrame implements ActionListener {
JLabel l1, l3, l7, l8, bgLabel;
JButton b1, b2, b3, b4, b5, b6, b7;
String nam;
String lid;
private PreparedStatement ps1, ps2, ps3, ps4, ps5, ps6;
private ResultSet rs1, rs2, rs3, rs4, rs5, rs6, rs7;
int dd, mm, yy;
String date;
int apno;
Font f;
Font fbig;
public StudentPortal(String title, String pno) {
super(title);
f = new Font("Arial", Font.BOLD, 20);
fbig = new Font("Arial", Font.BOLD, 25);
setLayout(null);
Calendar cal = new GregorianCalendar();
dd = cal.get(Calendar.DATE);
mm = cal.get(Calendar.MONTH) + 1;
yy = cal.get(Calendar.YEAR);
date = dd + "/" + mm + "/" + yy;
b1 = new JButton("Fill Admission Form");
b2 = new JButton("Change Password");
b3 = new JButton("Merit List");
b4 = new JButton("Pay Fee");
b5 = new JButton("Generate Fee Receipt");
b6 = new JButton("Instructions");
b7 = new JButton("Logout");
b3.setEnabled(false);
b4.setEnabled(false);
b5.setEnabled(false);
Color customBlue = new Color(99, 60, 204);
b4.setBackground(customBlue);
b5.setBackground(customBlue);
b3.setBackground(customBlue);
b1.setBackground(customBlue);
b2.setBackground(customBlue);
b6.setBackground(customBlue);
Color customPink = new Color(255, 96, 92);
b7.setBackground(customPink);
b7.setForeground(Color.white);
b1.setForeground(Color.white);
b2.setForeground(Color.white);
b3.setForeground(Color.white);
b4.setForeground(Color.white);
b5.setForeground(Color.white);
b6.setForeground(Color.white);
try {
Database db = new Database();
Connection con = db.connect();
ps1 = con.prepareStatement("select username from log where mob=?");
ps1.setString(1, pno);
rs1 = ps1.executeQuery();
rs1.next();
nam = rs1.getString("username");
ps2 = con.prepareStatement("select username from log where mob=?");
ps2.setString(1, pno);
rs2 = ps2.executeQuery();
rs2.next();
lid = rs2.getString("username");
ps5 = con.prepareStatement("select * from candidate_details where cmob=?");
ps5.setString(1, pno);
rs5 = ps5.executeQuery();
if (rs5.next()) {
b1.setEnabled(false);
b1.setBackground(Color.white);
ps3 = con.prepareStatement("select ano from candidate_details where cmob=?");
ps3.setString(1, pno);
rs3 = ps3.executeQuery();
rs3.next();
apno = rs3.getInt("ano");
ps4 = con.prepareStatement("select * from merit_details where ano=?");
ps4.setInt(1, apno);
rs4 = ps4.executeQuery();
rs4.next();
}
Statement st = con.createStatement();
rs7 = st.executeQuery("select * from merit_list");
if (rs7.next()) {
b3.setEnabled(true);
b4.setEnabled(true);
b5.setEnabled(true);
}
ps6 = con.prepareStatement("select * from fee where ano=?");
ps6.setInt(1, apno);
rs6 = ps6.executeQuery();
rs6.next();
String status = rs6.getString("status");
if (status.equals("paid")) {
b4.setEnabled(false);
b4.setBackground(Color.white);
}
} catch (Exception e) {
}
l1 = new JLabel("Welcome");
l1.setFont(fbig);
l3 = new JLabel(nam);
l3.setFont(fbig);
l7 = new JLabel("Date:");
l7.setFont(f);
l8 = new JLabel(date);
l8.setFont(f);
l1.setForeground(Color.white);
l3.setForeground(Color.white);
l7.setForeground(Color.white);
l8.setForeground(Color.white);
l1.setBounds(400, 100, 150, 20);
l3.setBounds(400, 130, 260, 20);
add(l1);
add(l3);
b1.setBounds(0, 0, 200, 30);
add(b1);
l7.setBounds(30, 500, 50, 30);
l8.setBounds(90, 500, 150, 30);
add(l7);
add(l8);
b2.setBounds(205, 0, 150, 30);
b3.setBounds(360, 0, 150, 30);
b4.setBounds(515, 0, 150, 30);
b5.setBounds(670, 0, 230, 30);
b6.setBounds(0, 35, 150, 30);
b7.setBounds(750, 35, 150, 30);
add(b2);
add(b3);
add(b4);
add(b5);
add(b6);
add(b7);
bgLabel = new JLabel(new ImageIcon("StudentPortalbg.png"));
bgLabel.setBounds(0, -30, 900, 600);
add(bgLabel);
b1.setBorderPainted(true);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == b1) {
AdmissionLogin adm = new AdmissionLogin("Admission Form");
adm.setSize(1300, 730);
adm.setLocation(30, 0);
adm.setVisible(true);
}
if (ae.getSource() == b2) {
ChangePassword chp = new ChangePassword("Change Password");
chp.setSize(900, 600);
chp.setLocation(400, 150);
chp.setVisible(true);
}
if (ae.getSource() == b3) {
MeritList ml = new MeritList("LIST");
ml.setSize(900, 600);
ml.setLocation(500, 10);
ml.setVisible(true);
}
if (ae.getSource() == b4) {
PayFee pf = new PayFee("PAY FEE", apno);
pf.setSize(900, 600);
pf.setLocation(500, 200);
pf.setVisible(true);
}
if (ae.getSource() == b5) {
FeeReciept fr = new FeeReciept("FEE RECIEPT", apno);
fr.setSize(900, 600);
fr.setLocation(250, 200);
fr.setVisible(true);
}
if (ae.getSource() == b6) {
Instructions ins = new Instructions("INSTRUCTIONS");
ins.setSize(900, 600);
ins.setLocation(250, 200);
ins.setVisible(true);
}
if (ae.getSource() == b7) {
int result = JOptionPane.showConfirmDialog(null, "Are You Sure?", "Confirmation Dialog",
JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
dispose();
}
}
}
public static void main(String[] args) {
StudentPortal span = new StudentPortal("Student Panel", "9643171490");
span.setSize(900, 600);
span.setResizable(false);
span.setLocation(550, 225);
span.setDefaultCloseOperation(EXIT_ON_CLOSE);
span.setVisible(true);
span.setResizable(false);
span.getContentPane().setBackground(Color.white);
}
}