예제 #1
0
 private Student getSelectedIndex(String action) {
   try {
     Student selectedStudent = (Student) studentsComboBox.getSelectedItem();
     if (0
         == JOptionPane.showConfirmDialog(
             null,
             "Are you sure you want to " + action.toLowerCase() + selectedStudent.toString(),
             action.toUpperCase(),
             JOptionPane.YES_NO_OPTION)) {
       return selectedStudent;
     }
   } catch (ClassCastException e) {
     MainWindow.showMessageWindow("No registered Students", action.toUpperCase());
   }
   return null;
 }