JFrame parent = new JFrame(); // never shown
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Please choose a file: ");
fc.addChoosableFileFilter(new ExtensionFilter("txt", "Text Files"));
fc.addChoosableFileFilter(new ExtensionFilter("java", "Java Source Code"));
fc.addChoosableFileFilter(new ExtensionFilter(".c", "C Source Code"));
fc.addChoosableFileFilter(new ExtensionFilter(".pl", "Perl Source Code"));
fc.addChoosableFileFilter(new ExtensionFilter(".html", "HTML Files"));
fc.showOpenDialog(parent);
parent.dispose();
// Work around annoying AWT non-daemon thread bug
System.exit(0);