@SuppressWarnings("unchecked")
 protected void whenClassroomsTableSelectionChanged(ListSelectionEvent anEvent) {
   DefaultListSelectionModel source = (DefaultListSelectionModel) anEvent.getSource();
   if (source.isSelectionEmpty()) {
     classroomSelected = null;
     moveAssignmentOfClassroomButton.setEnabled(false);
   } else {
     int index = source.getMinSelectionIndex();
     List<Classroom> model =
         ((ReadOnlyTableModel<Classroom>) classroomsTable.getModel()).getModel();
     classroomSelected = model.get(index);
     moveAssignmentOfClassroomButton.setEnabled(
         !classroomSelected.equals(assignment.getAssignableItem()));
   }
 }
  public EditAssignmentWindow(
      AssignmentsDepartment assignmentsDepartment, ClassroomAssignment selection) {
    department = assignmentsDepartment;
    assignment = selection;
    period = selection.getPeriod();

    SwingUtilities.invokeLater(
        () -> {
          createSearchComponents();
          createClassroomsTable();
          createButtons();
          organizeComponents();

          setResizable(false);
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          setTitle("Modificar asignación");
          setSize(350, 450);
          setLocationRelativeTo(null);
          setVisible(true);
        });
  }