public void addFilesOrDir(Component parent) {
    final JFileChooser resfc = new JFileChooser();
    resfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    int returnVal = resfc.showOpenDialog(parent);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = resfc.getSelectedFile();

      if (file.isDirectory()) {

        List<File> listing =  Arrays.asList(file.listFiles());
        for (File lf: listing) {
          if (file.getName().endsWith(".sgf")) {
            addEntry(file.getAbsolutePath());
          }
        }

      } else if (file.isFile()) {
        if (file.getName().endsWith(".sgf")) {
          addEntry(file.getAbsolutePath());
        } }
    } else {
      return;
    }
  }