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

        JFileChooser chooser = new JFileChooser();
        int returnOption = chooser.showOpenDialog(this);

        switch (returnOption) {
            case JFileChooser.CANCEL_OPTION:

                JOptionPane.showMessageDialog(null, "You must select a file to continue.", "Warning", JOptionPane.WARNING_MESSAGE);
                analyzeButton.setEnabled(false);
                fileField.setText("");

                break;
            case JFileChooser.APPROVE_OPTION:
                
                if (chooser.getDescription(chooser.getSelectedFile()).toLowerCase().endsWith(".xml")) {
                    xml.setFile(chooser.getSelectedFile());
                    fileField.setText(xml.getFileName());
                    try {
                        xml.parseXML();
                        analyzeButton.setEnabled(true);
                        analyzeButton.requestFocus();
                    } catch (FileNotFoundException e) {
                        System.out.println(e);
                    }
                } else {
                    JOptionPane.showMessageDialog(null, "You must choose a .xml file.", "Wrong File Type", JOptionPane.INFORMATION_MESSAGE);
                    analyzeButton.setEnabled(false);
                }
                break;
            case JFileChooser.ERROR_OPTION:
                JOptionPane.showMessageDialog(null, "Something went wrong.", "Error", JOptionPane.ERROR_MESSAGE);
                analyzeButton.setEnabled(false);
                break;
            default:
                JOptionPane.showMessageDialog(null, "Something went wrong.", "Error", JOptionPane.ERROR_MESSAGE);
                analyzeButton.setEnabled(false);
        }
    }//GEN-LAST:event_browseButtonActionPerformed