fileChooser.setDialogTitle("Select a file to save random data");
FileNameExtensionFilter filter = new FileNameExtensionFilter("raw data file", "dat");
fileChooser.addChoosableFileFilter(filter);
fileChooser.setAcceptAllFileFilterUsed(true);
long start = System.nanoTime();
int option = fileChooser.showOpenDialog(null);
deadTime += System.nanoTime() - start;
fileChooser.dispose();
if (option != JFileChooser.APPROVE_OPTION) {
throw new StopRequestFromUserException();//if user give up, we give up too...
}