private boolean learn(boolean record) throws FileNotFoundException {
        File file = new File("data/" + txtFile.getText());
        if (lstTypes.getSelectedIndex() < 0) {
            return true;
        }
        if (btnLearn.getText().equals("Learn")) {
            for (LinkKNN knn : knns) {
                knn.learnType((String) lstTypes.getSelectedValue());
            }
            if (record) {
                Datasource.getInstance().startRecording(file);
            }
            btnLearn.setText("Stop");
            btnPlayback.setEnabled(false);
            btnRecord.setEnabled(false);
        } else {
            for (LinkKNN knn : knns) {
                knn.stopLearning();
            }
            Datasource.getInstance().stopRecording();
            btnLearn.setText("Learn");
            btnPlayback.setEnabled(true);
            btnRecord.setEnabled(true);
        }
        return false;
    }