-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentResultsPage.java
More file actions
859 lines (755 loc) · 43.3 KB
/
StudentResultsPage.java
File metadata and controls
859 lines (755 loc) · 43.3 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
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
public class StudentResultsPage extends javax.swing.JFrame {
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(StudentResultsPage.class.getName());
private Student student;
public StudentResultsPage() {
initComponents();
}
public StudentResultsPage(Student student) {
initComponents();
this.student = student;
studentNameLabel.setText(student.getStudentName() + " (" + student.getUserID() + ")");
courseNameLabel.setText(student.getMajor());
loadStudentResults();
updateCGPADisplay();
}
// Load student results into table
private void loadStudentResults() {
DefaultTableModel model = (DefaultTableModel) academicResultsTable.getModel();
model.setRowCount(0);
int count = student.getResultCount();
for (int i = 0; i < count; i++) {
StudentResult result = student.getResultByIndex(i);
if (result != null) {
model.addRow(new Object[]{
result.getCourseID(),
result.getCourseName(),
// result.getMarks(),
result.getGrade(),
result.getGPA(),
result.getStatus(),
result.getAttempts()
});
}
}
}
// Update CGPA display with color coding
private void updateCGPADisplay() {
double cgpa = student.calculateCGPA();
cgpaValueLabel.setText(String.format("%.2f", cgpa));
if (cgpa >= 3.5) {
cgpaValueLabel.setForeground(new java.awt.Color(0, 153, 0));
} else if (cgpa >= 2.0) {
cgpaValueLabel.setForeground(new java.awt.Color(255, 153, 0));
} else {
cgpaValueLabel.setForeground(new java.awt.Color(255, 0, 0));
}
}
private void changePasswordBtnActionPerformed(java.awt.event.ActionEvent evt) {
showChangePasswordDialog();
}
private void showChangePasswordDialog() {
JDialog passwordDialog = new JDialog(this, "Change Password", true);
passwordDialog.setLayout(new BorderLayout(10, 10));
passwordDialog.setSize(400, 250);
passwordDialog.setLocationRelativeTo(this);
// Main panel with padding
JPanel mainPanel = new JPanel(new GridBagLayout());
mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(5, 5, 5, 5);
// Title
JLabel titleLabel = new JLabel("Change Your Password");
titleLabel.setFont(new Font("Helvetica Neue", Font.BOLD, 16));
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.insets = new Insets(0, 0, 15, 0);
mainPanel.add(titleLabel, gbc);
// Reset insets
gbc.insets = new Insets(5, 5, 5, 5);
gbc.gridwidth = 1;
// New Password Label
JLabel newPasswordLabel = new JLabel("New Password:");
newPasswordLabel.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 0.3;
mainPanel.add(newPasswordLabel, gbc);
// New Password Field
JPasswordField newPasswordField = new JPasswordField();
newPasswordField.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 0.7;
mainPanel.add(newPasswordField, gbc);
// Confirm Password Label
JLabel confirmPasswordLabel = new JLabel("Confirm Password:");
confirmPasswordLabel.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 0.3;
mainPanel.add(confirmPasswordLabel, gbc);
// Confirm Password Field
JPasswordField confirmPasswordField = new JPasswordField();
confirmPasswordField.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
gbc.gridx = 1;
gbc.gridy = 2;
gbc.weightx = 0.7;
mainPanel.add(confirmPasswordField, gbc);
// Button Panel
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
// Cancel Button
JButton cancelButton = new JButton("Cancel");
cancelButton.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
cancelButton.setPreferredSize(new Dimension(100, 35));
cancelButton.addActionListener(e -> passwordDialog.dispose());
// Change Button
JButton changeButton = new JButton("Change");
changeButton.setFont(new Font("Helvetica Neue", Font.BOLD, 14));
changeButton.setBackground(new Color(0, 102, 204));
changeButton.setForeground(Color.WHITE);
changeButton.setPreferredSize(new Dimension(100, 35));
changeButton.addActionListener(e -> {
String newPassword = new String(newPasswordField.getPassword());
String confirmPassword = new String(confirmPasswordField.getPassword());
if (newPassword.isEmpty() || confirmPassword.isEmpty()) {
JOptionPane.showMessageDialog(passwordDialog,
"Please fill in all fields!",
"Error",
JOptionPane.ERROR_MESSAGE);
} else if (!newPassword.equals(confirmPassword)) {
JOptionPane.showMessageDialog(passwordDialog,
"Passwords do not match!",
"Error",
JOptionPane.ERROR_MESSAGE);
} else if (newPassword.length() < 6) {
JOptionPane.showMessageDialog(passwordDialog,
"Password must be at least 6 characters!",
"Error",
JOptionPane.ERROR_MESSAGE);
} else {
// Call method to update password in database/system
boolean success = updatePassword(student.getUserID(), newPassword);
if (success) {
JOptionPane.showMessageDialog(passwordDialog,
"Password changed successfully!",
"Success",
JOptionPane.INFORMATION_MESSAGE);
passwordDialog.dispose();
} else {
JOptionPane.showMessageDialog(passwordDialog,
"Failed to change password. Please try again.",
"Error",
JOptionPane.ERROR_MESSAGE);
}
}
});
buttonPanel.add(cancelButton);
buttonPanel.add(changeButton);
passwordDialog.add(mainPanel, BorderLayout.CENTER);
passwordDialog.add(buttonPanel, BorderLayout.SOUTH);
passwordDialog.setVisible(true);
}
private boolean updatePassword(String userID, String newPassword) {
try {
student.updatePasswordInSystem(userID, newPassword);
return true;
} catch (Exception ex) {
logger.log(java.util.logging.Level.SEVERE, "Error updating password", ex);
return false;
}
}
// Generate PDF transcript
private void generateTranscriptBtnActionPerformed(java.awt.event.ActionEvent evt) {
String cgpaValue = cgpaValueLabel.getText();
student.generateTranscript(
student.getUserID(),
student.getStudentName(),
student.getMajor(),
cgpaValue
);
}
// Load retake schedule for selected course
private void loadRetakeSchedule(String courseID) {
DefaultTableModel model = (DefaultTableModel) retakeScheduleTable.getModel();
model.setRowCount(0);
int count = student.getRetakeTaskCount(courseID);
for (int i = 0; i < count; i++) {
String[] task = student.getRetakeTask(courseID, i);
if (task != null) {
model.addRow(new Object[]{
task[0], // week
task[1], // date
task[2] // task
});
}
}
}
// Filter results by semester
private void semesterComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
String selectedSemester = semesterComboBox.getSelectedItem().toString();
filterResultsBySemester(selectedSemester);
}
private void filterResultsBySemester(String semester) {
DefaultTableModel model = (DefaultTableModel) academicResultsTable.getModel();
model.setRowCount(0);
int count = student.getResultCountBySemester(semester);
for (int i = 0; i < count; i++) {
StudentResult result = student.getResultByIndexAndSemester(i, semester);
if (result != null) {
model.addRow(new Object[]{
result.getCourseID(),
result.getCourseName(),
// result.getMarks(),
result.getGrade(),
result.getGPA(),
result.getStatus(),
result.getAttempts()
});
}
}
updateCGPADisplay();
}
// Logout action
private void logoutbtnActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
LoginPage loginPage = new LoginPage();
loginPage.setVisible(true);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
// Panels
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
// Header components
headerLabel = new javax.swing.JLabel();
logoutbtn = new javax.swing.JButton();
welcomeLabel = new javax.swing.JLabel();
courseLabel = new javax.swing.JLabel();
semesterLabel = new javax.swing.JLabel();
studentNameLabel = new javax.swing.JLabel();
courseNameLabel = new javax.swing.JLabel();
semesterComboBox = new javax.swing.JComboBox<>();
changePasswordBtn = new javax.swing.JButton();
// Table and label components
generateTranscriptBtn = new javax.swing.JButton();
academicResultsTable = new javax.swing.JTable();
academicScrollPane = new javax.swing.JScrollPane();
retakeScheduleTable = new javax.swing.JTable();
retakeScrollPane = new javax.swing.JScrollPane();
academicResultLabel = new javax.swing.JLabel();
retakeScheduleLabel = new javax.swing.JLabel();
cgpaLabel = new javax.swing.JLabel();
cgpaValueLabel = new javax.swing.JLabel();
// Marks and grades components
distinctionLabel = new javax.swing.JLabel();
marksAndGradesLabel = new javax.swing.JLabel();
creditLabel = new javax.swing.JLabel();
passLabel = new javax.swing.JLabel();
failMarginalLabel = new javax.swing.JLabel();
failLabel = new javax.swing.JLabel();
gradeAPlusLabel = new javax.swing.JLabel();
gradeBPlusLabel = new javax.swing.JLabel();
gradeBLabel = new javax.swing.JLabel();
gradeALabel = new javax.swing.JLabel();
gradeCPlusLabel = new javax.swing.JLabel();
gradeCLabel = new javax.swing.JLabel();
gradeCMinusLabel = new javax.swing.JLabel();
gradeDLabel = new javax.swing.JLabel();
gradeFPlusLabel = new javax.swing.JLabel();
gradeFLabel = new javax.swing.JLabel();
gpaWarningLabel = new javax.swing.JLabel();
retakeModuleLabel = new javax.swing.JLabel();
// Unused components
jTable4 = new javax.swing.JTable();
jTable6 = new javax.swing.JTable();
jScrollPane4 = new javax.swing.JScrollPane();
jScrollPane6 = new javax.swing.JScrollPane();
jLabel3 = new javax.swing.JLabel();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel2.setBackground(new java.awt.Color(102, 102, 102));
headerLabel.setFont(new java.awt.Font("Microsoft PhagsPa", 1, 24));
headerLabel.setForeground(new java.awt.Color(255, 255, 255));
headerLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
headerLabel.setText("Students Results Checking System");
logoutbtn.setBackground(new java.awt.Color(225, 0, 0));
logoutbtn.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
logoutbtn.setForeground(new java.awt.Color(255, 255, 255));
logoutbtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/logout.png")));
logoutbtn.setText(" Logout");
logoutbtn.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
logoutbtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
logoutbtnActionPerformed(evt);
}
});
changePasswordBtn.setBackground(new java.awt.Color(255, 255, 255));
changePasswordBtn.setFont(new java.awt.Font("Helvetica Neue", 1, 13));
changePasswordBtn.setForeground(new java.awt.Color(255, 255, 255));
changePasswordBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/edit.png")));
changePasswordBtn.setToolTipText("Change Password");
changePasswordBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
changePasswordBtn.setPreferredSize(new Dimension(45, 36));
ImageIcon icon = new ImageIcon(getClass().getResource("/Images/edit.png"));
Image image = icon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
changePasswordBtn.setIcon(new ImageIcon(image));
changePasswordBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
changePasswordBtnActionPerformed(evt);
}
});
welcomeLabel.setFont(new java.awt.Font("Microsoft PhagsPa", 1, 18));
welcomeLabel.setForeground(new java.awt.Color(255, 255, 255));
welcomeLabel.setText("Welcome back,");
courseLabel.setFont(new java.awt.Font("Microsoft PhagsPa", 1, 18));
courseLabel.setForeground(new java.awt.Color(255, 255, 255));
courseLabel.setText("Major:");
semesterLabel.setFont(new java.awt.Font("Microsoft PhagsPa", 1, 18));
semesterLabel.setForeground(new java.awt.Color(255, 255, 255));
semesterLabel.setText("Semester:");
semesterComboBox.setBackground(new java.awt.Color(204, 204, 204));
semesterComboBox.setFont(new java.awt.Font("Segoe UI", 0, 18));
semesterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "All","Spring", "Summer", "Fall"}));
semesterComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
semesterComboBoxActionPerformed(evt);
}
});
cgpaLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
cgpaLabel.setText("CGPA:");
cgpaValueLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
cgpaValueLabel.setText("0.00");
cgpaValueLabel.setForeground(new java.awt.Color(0, 153, 0));
studentNameLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
studentNameLabel.setForeground(new java.awt.Color(255, 255, 255));
studentNameLabel.setText("Student Name + TP number");
courseNameLabel.setBackground(new java.awt.Color(204, 204, 204));
courseNameLabel.setFont(new java.awt.Font("Segoe UI", 0, 18));
courseNameLabel.setForeground(new java.awt.Color(10, 10, 10));
courseNameLabel.setOpaque(true);
courseNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(welcomeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(studentNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(headerLabel)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(courseLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(courseNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(semesterLabel)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(semesterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(changePasswordBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(logoutbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(logoutbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(changePasswordBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(headerLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(welcomeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(studentNameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(courseLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(semesterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(semesterLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(courseNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(17, Short.MAX_VALUE))
);
retakeScrollPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
retakeScheduleTable.setModel(new javax.swing.table.DefaultTableModel(
new String [] {
"Week", "Date", "Task"
},
0
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
retakeScheduleTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
retakeScheduleTable.getColumnModel().getColumn(0).setPreferredWidth(53);
retakeScheduleTable.getColumnModel().getColumn(1).setPreferredWidth(130);
retakeScheduleTable.getColumnModel().getColumn(2).setPreferredWidth(190);
retakeScrollPane.setViewportView(retakeScheduleTable);
academicScrollPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
academicResultsTable.setModel(new javax.swing.table.DefaultTableModel(
new String [] {
"Course ID", "Course Name", "Result", "Grade (GPA)", "Retake Grade (GPA)", "Status"
},
0
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class,
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
academicResultsTable.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
int selectedRow = academicResultsTable.getSelectedRow();
if (selectedRow != -1) {
String courseID = academicResultsTable.getValueAt(selectedRow, 0).toString();
String status = academicResultsTable.getValueAt(selectedRow, 5).toString();
if (status.equalsIgnoreCase("Failed")) {
loadRetakeSchedule(courseID);
} else {
DefaultTableModel model = (DefaultTableModel) retakeScheduleTable.getModel();
model.setRowCount(0);
}
}
}
});
academicResultsTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
academicScrollPane.setViewportView(academicResultsTable);
academicResultsTable.getColumnModel().getColumn(0).setPreferredWidth(100);
academicResultsTable.getColumnModel().getColumn(1).setPreferredWidth(200);
academicResultsTable.getColumnModel().getColumn(2).setPreferredWidth(70);
academicResultsTable.getColumnModel().getColumn(3).setPreferredWidth(100);
academicResultsTable.getColumnModel().getColumn(4).setPreferredWidth(150);
academicResultsTable.getColumnModel().getColumn(5).setPreferredWidth(102);
academicResultLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
academicResultLabel.setText("Academic Result");
generateTranscriptBtn.setBackground(new java.awt.Color(0, 102, 204));
generateTranscriptBtn.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
generateTranscriptBtn.setForeground(new java.awt.Color(255, 255, 255));
generateTranscriptBtn.setText("Generate Transcript");
generateTranscriptBtn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
generateTranscriptBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
generateTranscriptBtnActionPerformed(evt);
}
});
retakeScheduleLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
retakeScheduleLabel.setText("Retake Schedule");
jPanel1.setBackground(new java.awt.Color(102, 102, 102));
distinctionLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
distinctionLabel.setForeground(new java.awt.Color(0, 255, 0));
distinctionLabel.setText("Distinction");
marksAndGradesLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
marksAndGradesLabel.setForeground(new java.awt.Color(255, 255, 255));
marksAndGradesLabel.setText("Marks and Grades");
creditLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
creditLabel.setForeground(new java.awt.Color(0, 200, 0));
creditLabel.setText("Credit");
passLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
passLabel.setForeground(new java.awt.Color(255, 255, 0));
passLabel.setText("Pass");
failMarginalLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
failMarginalLabel.setForeground(new java.awt.Color(255, 71, 80));
failMarginalLabel.setText("Fail (Marginal)");
failLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 14));
failLabel.setForeground(new java.awt.Color(255, 0, 0));
failLabel.setText("Fail");
gradeAPlusLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeAPlusLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeAPlusLabel.setText("80-100 - A+ (4.00)");
gradeBPlusLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeBPlusLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeBPlusLabel.setText("70-74 - B+ (3.30)");
gradeBLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeBLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeBLabel.setText("65-59 - B (3.00)");
gradeALabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeALabel.setForeground(new java.awt.Color(255, 255, 255));
gradeALabel.setText("75-79 - A (3.70)");
gradeCPlusLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeCPlusLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeCPlusLabel.setText("60-64 - C+ (2.70)");
gradeCLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeCLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeCLabel.setText("55-59 - C (2.30)");
gradeCMinusLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeCMinusLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeCMinusLabel.setText("50-54 - C- (2.00)");
gradeDLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeDLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeDLabel.setText("40-49 - D (1.70)");
gradeFPlusLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeFPlusLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeFPlusLabel.setText("30-39 - F+ (1.30)");
gradeFLabel.setFont(new java.awt.Font("Helvetica Neue", 0, 14));
gradeFLabel.setForeground(new java.awt.Color(255, 255, 255));
gradeFLabel.setText("20-29 - F (1.00)");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(257, 257, 257)
.addComponent(distinctionLabel)
.addGap(71, 71, 71)
.addComponent(creditLabel))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(marksAndGradesLabel)
.addGap(49, 49, 49)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(gradeAPlusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gradeALabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(gradeBPlusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gradeBLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(gradeCPlusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gradeCMinusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gradeCLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(38, 38, 38)
.addComponent(passLabel)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(gradeDLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(failMarginalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(gradeFPlusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gradeFLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(failLabel)))
.addContainerGap(32, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(distinctionLabel)
.addComponent(creditLabel)
.addComponent(passLabel)
.addComponent(failMarginalLabel)
.addComponent(failLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(marksAndGradesLabel)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(gradeAPlusLabel)
.addComponent(gradeBPlusLabel)
.addComponent(gradeCPlusLabel)
.addComponent(gradeDLabel)
.addComponent(gradeFPlusLabel)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(gradeALabel)
.addComponent(gradeBLabel)
.addComponent(gradeCLabel)
.addComponent(gradeFLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(gradeCMinusLabel)
.addContainerGap(20, Short.MAX_VALUE))
);
jPanel3.setBackground(new java.awt.Color(255, 102, 102));
gpaWarningLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
gpaWarningLabel.setForeground(new java.awt.Color(255, 255, 255));
gpaWarningLabel.setText("GPA < 2.0");
retakeModuleLabel.setFont(new java.awt.Font("Helvetica Neue", 1, 18));
retakeModuleLabel.setForeground(new java.awt.Color(255, 255, 255));
retakeModuleLabel.setText("Retake Module");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(46, 46, 46)
.addComponent(retakeModuleLabel)
.addContainerGap(44, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gpaWarningLabel)
.addGap(64, 64, 64))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(retakeModuleLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(gpaWarningLabel)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(academicScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 728, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(academicResultLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(generateTranscriptBtn)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(retakeScheduleLabel)
.addGap(234, 234, 234))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(retakeScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGap(8, 8, 8))))
.addGroup(layout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(cgpaLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cgpaValueLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 25, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(academicResultLabel)
.addComponent(generateTranscriptBtn)
.addComponent(retakeScheduleLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(academicScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(retakeScrollPane))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cgpaLabel)
.addComponent(cgpaValueLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
pack();
}// </editor-fold>
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ReflectiveOperationException | javax.swing.UnsupportedLookAndFeelException ex) {
logger.log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(() -> new StudentResultsPage().setVisible(true));
}
// Variables declaration
private javax.swing.Box.Filler filler1;
private javax.swing.JButton logoutbtn;
private javax.swing.JLabel courseNameLabel;
private javax.swing.JComboBox<String> semesterComboBox;
private javax.swing.JLabel headerLabel;
private javax.swing.JLabel welcomeLabel;
private javax.swing.JLabel courseLabel;
private javax.swing.JLabel failMarginalLabel;
private javax.swing.JLabel semesterLabel;
private javax.swing.JLabel failLabel;
private javax.swing.JLabel gradeAPlusLabel;
private javax.swing.JLabel gradeBPlusLabel;
private javax.swing.JLabel gradeBLabel;
private javax.swing.JLabel gradeALabel;
private javax.swing.JLabel gradeCPlusLabel;
private javax.swing.JLabel studentNameLabel;
private javax.swing.JLabel gradeCLabel;
private javax.swing.JLabel gradeCMinusLabel;
private javax.swing.JLabel gradeDLabel;
private javax.swing.JLabel gpaWarningLabel;
private javax.swing.JLabel retakeModuleLabel;
private javax.swing.JLabel gradeFPlusLabel;
private javax.swing.JLabel gradeFLabel;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel academicResultLabel;
private javax.swing.JLabel retakeScheduleLabel;
private javax.swing.JLabel distinctionLabel;
private javax.swing.JLabel marksAndGradesLabel;
private javax.swing.JLabel creditLabel;
private javax.swing.JLabel passLabel;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane academicScrollPane;
private javax.swing.JScrollPane retakeScrollPane;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JTable academicResultsTable;
private javax.swing.JTable retakeScheduleTable;
private javax.swing.JLabel cgpaLabel;
private javax.swing.JLabel cgpaValueLabel;
private javax.swing.JButton generateTranscriptBtn;
private javax.swing.JButton changePasswordBtn;
private javax.swing.JTable jTable4;
private javax.swing.JTable jTable6;
}