private void queryBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryBtnActionPerformed

        dbTA.setText("");
        try {
            //Collecting contents of relevant data input fields from the GUI
            String theFN = firstNameTxt.getText();
            String theLN = lastNameTxt.getText();
            int theStudID = 0;
            float theGPA = 0;
            String theStatus = statusCB.getSelectedItem().toString();
            String theMentor = mentorTxt.getText();
            String theStudType = studentTypeCB.getSelectedItem().toString();
            String theLevel = levelCB.getSelectedItem().toString();
            String theThesisTitle = thesisTitleTxt.getText();
            String theThesisAdvisor = thesisAdvisorTxt.getText();
            String theCompany = companyTxt.getText();

            /**
             * A studentID will only be included in the query if and only if
             * the field contains a valid integer.
             */
            if (Student.numbersOnly(studIDTxt.getText())) {
                theStudID = Integer.parseInt(studIDTxt.getText());
            }

            /**
             * A gpa will only be included in the query if and only if
             * the field contains a valid float value.
             */
            if (Student.containsGPA(gpaTxt.getText())) {
                theGPA = Float.parseFloat(gpaTxt.getText());
            }

            /**
             * Queries an Undergraduate student if enough query data exits
             * to construct an Undergraduate object.
             */
            if (theStudType.equals("Undergraduate") | Student.containsText(theLevel)) {
                Student newUG = new Undergraduate(theFN, theLN, theStudID,
                        theGPA, theStatus, theMentor, theStudType, theLevel);
                dbTA.append(newUG.query());

            }

            /**
             * Queries a Graduate student if enough query data exists to
             * construct a Graduate object.
             */
            else if(theStudType.equals("Graduate") | Student.containsText(theThesisTitle)
                     | Student.containsText(theThesisAdvisor)) {
                Student newGR = new Graduate(theFN, theLN, theStudID,
                        theGPA, theStatus, theMentor, theStudType, theThesisTitle,
                        theThesisAdvisor);
                dbTA.append(newGR.query());

            }

            /**
             * Queries a PartTime student if enough query data exists to
             * construct a PartTime object.
             */
            else if(theStudType.equals("Part-Time") | Student.containsText(theCompany)) {
                Student newPT = new PartTime(theFN, theLN, theStudID, theGPA,
                        theStatus, theMentor, theStudType, theCompany);
                dbTA.append(newPT.query());

            }
            
            //Queries any student in the DB if studentType or type-specific
            //fields are not filled out.
            else {
                Student stud = new Undergraduate(theFN, theLN, theStudID, 
                        theGPA, theStatus, theMentor, theStudType, theLevel);
                stud.setStudentType(" ");
                dbTA.append(stud.query());
            }


        }

        /**
         * This catch block handles the exception thrown if any required field
         * is left blank in the GUI.
         */

        catch (Exception e) {
            JOptionPane.showMessageDialog(this, "You must enter a valid entry"
                    + " for Student Type!  Please try again!", "Error",
                    JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_queryBtnActionPerformed