code: public static String selectFile(boolean exitOnCancel) {
  		String fileName = null;
  		JFileChooser fc = new JFileChooser();
  
  		int returnVal = fc.showOpenDialog(null);
  
  		if (returnVal == JFileChooser.APPROVE_OPTION) {
  			fileName = fc.getSelectedFile().getAbsolutePath();
  		} else if (exitOnCancel) {
  			System.exit(0);
  		}
  
  		return fileName;
  	}
docs: Opens up a dialog box asking the user to select a file.  If the user cancels
  it either returns null or quits the program.
  
  @param exitOnCancel If it should quit on cancel or not.
  @return Name of the selected file or null if nothing was selected.