private void addMentorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addMentorBtnActionPerformed
        
        studentListTA.setText("");

        try {
            //Collecting mentor attributes
            String mentorFN = mentorFNTxt.getText();
            String mentorLN = mentorLNTxt.getText();
            String addStudIDs = addStudentsTA.getText();

            
            /**
             * If the mentor name fields or the student ID list is left blank,
             * an exception is thrown.
             */
            if (!Student.containsText(mentorFN)
                    || !Student.containsText(mentorLN)
                    || !Student.containsText(addStudIDs)) {
                throw new Exception();
            }
            
            //This creates a string array of individual studentIDs.
            String[] studIDStrings = addStudIDs.split("\\n");

            /**
             * This creates an array of studentID ints that can be passed as
             * an argument to the addStudent() method.
             */
            int[] studentIDs = new int[studIDStrings.length];
            for (int i = 0; i < studIDStrings.length; i++) {
                int nextID = Integer.parseInt(studIDStrings[i]);
                studentIDs[i] = nextID;
            }

            /**
             * Constructs the mentor object and performs the addStudent method
             * that associates the mentor with each specified student.
             */
            Mentor newMentor = new Mentor(mentorFN, mentorLN);
            JOptionPane.showMessageDialog(this, newMentor.addStudent(studentIDs));


        }

        /**
         * The only reason an exception is likely to occur, other than
         * the exception explicitly thrown when required fields are left blank,
         * is if the operation to assign the mentor to the students in the list
         * fails due to non-numerical data or there not being a corresponding
         * student record.  Hence, this catch block serves all likely error
         * conditions for this event handler.
         */
        catch (Exception e) {
            JOptionPane.showMessageDialog(this, "You must enter a valid"
                    + " first and last name, and at least one valid Student ID\n"
                    + " that corresponds to an existing student record!"
                    + " Please ensure that all data is valid, \nand that multiple"
                    + " studentIDs are separated by a new line, and try again!",
                    "Error", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_addMentorBtnActionPerformed