// choose the file/folder to do batch query
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(false);
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setDialogTitle("Choose directory or file");
chooser.setFileView(new FileIcon(MapFrame.This()));
// filter file
String extension[] = {"tdb"};
chooser.addChoosableFileFilter(new SimpleFileFilter(extension, "Directory or .tdb"));
// display file chooser
int option = chooser.showOpenDialog(null);