@Override
  public void actionPerformed(ActionEvent e) {
    // TODO Auto-generated method stub
    if (e.getSource() == backButton) {
      CardLayout cl = (CardLayout) (this.card.getLayout());
      cl.show(this.card, "Menu");
    }

    // browse for source folder in preprocessing
    else if (e.getSource() == selectFolder1) {
      int a = srcFolder.showOpenDialog(this);
      if (a == JFileChooser.APPROVE_OPTION) {
        File file = srcFolder.getSelectedFile();
        folder1.setText(file.getAbsolutePath());
      }
    }
    // browse for destination folder in preprocessing
    else if (e.getSource() == selectDest) {
      int a = destFolder.showOpenDialog(this);
      if (a == JFileChooser.APPROVE_OPTION) {
        File file = destFolder.getSelectedFile();
        destination.setText(file.getAbsolutePath());
      }
    }
    // browse for source folder in train/test
    else if (e.getSource() == selectFolder2) {
      int a = tFolder.showOpenDialog(this);
      if (a == JFileChooser.APPROVE_OPTION) {
        File file = tFolder.getSelectedFile();
        folder2.setText(file.getAbsolutePath());
      }
    }
    // run test/train
    else if (e.getSource() == run) {
      String path = folder2.getText();
      if (train.isSelected()) {

        // reset graph and summary table
        resetResults();
        TrainTask trainTask = new TrainTask(this, path);
        // task.addPropertyChangeListener(this);
        trainTask.execute();
        run.setEnabled(false);

      } else if (test.isSelected()) {
        TestTask testTask = new TestTask(this, path);
        testTask.execute();
        run.setEnabled(false);

      } else if (eval.isSelected()) {
        // read the images
        // p.getAllFeatures2(path, "cross_validation_data");
        task = new Task(this);
        // task.addPropertyChangeListener(this);
        task.execute();
        run.setEnabled(false);
      }
    }
    // crop datasets
    else if (e.getSource() == crop) {
      String sourcePath = folder1.getText().replace("\\", "/") + "/";
      String destinationPath = destination.getText().replace("\\", "/") + "/";
      p.cropImages(setList.getSelectedIndex() + 1, sourcePath, destinationPath);
    } else if (e.getSource() == viewResults) {
      resultsDialog.setVisible(true);
    } else if (e.getSource() == viewConfButton) {
      d.setVisible(true);
    }

    // show confusion matrix
    else if (e.getSource() == viewANN) {
      // change color of button
      viewANN.setColor("orange");
      viewSVM.setColor("blue");
      viewBN.setColor("blue");

      this.fillConfTable(evalANN.confusionMatrix());
    } else if (e.getSource() == viewSVM) {

      viewSVM.setColor("orange");
      viewBN.setColor("blue");
      viewANN.setColor("blue");
      this.fillConfTable(evalSVM.confusionMatrix());
    } else if (e.getSource() == viewBN) {
      viewBN.setColor("orange");
      viewANN.setColor("blue");
      viewSVM.setColor("blue");
      this.fillConfTable(evalNB.confusionMatrix());
    }
  }