×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Cj Castro
Added: May 14, 2021 7:15 AM
Views: 4005
Tags: no tags
  1.  
  2.     /**
  3.      * When the display button is pressed, it would display information
  4.      * relating to the radio button selected.
  5.      * @param evt the event
  6.      */
  7.     private void displayBActionPerformed(java.awt.event.ActionEvent evt) {                                        
  8.         String str = "";
  9.         // When Student Radio Button is picked
  10.         if (studentRB.isSelected()) {
  11.             str += String.format("%s\n", "STUDENTS");
  12.             for (Student student : VanierSchoolSystem.students)
  13.                 str += String.format("%s\n", student);
  14.             displayWindowTA.setText(str);  
  15.         }
  16.         // When Teacher Radio Button is picked
  17.         if (teacherRB.isSelected()) {
  18.             str += String.format("\t%s\n", "TEACHERS");
  19.             // Each Vanier Teacher
  20.             for (Teacher teacher : VanierSchoolSystem.teachers) {
  21.                 str += String.format("%-10s : %s", "ID", teacher.userId);
  22.                 str += String.format("%-10s : %s %s", "Name", teacher.fname,
  23.                         teacher.lname);
  24.                 str += String.format("%s\n", "Teaching Courses");
  25.                     for (Course course : teacher.getTeachingCourses()) {
  26.                         str += String.format("%s\n", course.getCourseName());
  27.                     }
  28.             }
  29.             displayWindowTA.setText(str);
  30.         }
  31.