@Override public void actionPerformed(ActionEvent AE) { if (TempControll.ConnectionManagerObject.createConnection()) if (AE.getSource() == UpdateButton) { TempCourseTitle = CourseNameField.getText(); TempCourseCredit = (String) CourseCreditBox.getSelectedItem(); if (!TempCourseTitle.equals("")) { if (TempControll.DataEraseEditObject.editCourse( this.CourseNo, TempCourseTitle, TempCourseCredit)) JOptionPane.showMessageDialog( DEPC, "Information of '" + this.CourseNo + "' has been updated successfully.", "Updated", JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog( DEPC, "Information of '" + this.CourseNo + "' hasn't been updated.\nCheck if this course is still available & try again.", "Updated", JOptionPane.INFORMATION_MESSAGE); DEPC.dispose(); } else JOptionPane.showMessageDialog( DEPC, "Please, complete 'Course Title' field.", "Empty Course Title Field", JOptionPane.ERROR_MESSAGE); } }
@Override public void actionPerformed(ActionEvent AE) { if (AE.getSource() == CheckAll) { boolean Selection = CheckAll.isSelected(); if (Selection) CheckAll.setText("Uncheck all"); else CheckAll.setText("Check all"); for (int i = 0; i < NumberOfCourses; i++) My[i].CourseCheckBox.setSelected(Selection); } if (AE.getSource() == DocButton) if (TempControll.ConnectionManagerObject.createConnection()) { new File(System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/").mkdirs(); if (gatherDataForDocument()) { if (TempControll.StudentPdfObject.createPDF( this.Roll, this.Session, this.Selected, this.Taken, this.Completed, this.GPA)) JOptionPane.showMessageDialog( RPS, "Report created successfully at " + System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/", "Success", JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog( RPS, "Error while creating report.", "Error", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog( RPS, "At least one course has to be selected.", "Error : No Selection", JOptionPane.ERROR_MESSAGE); } }