code: private boolean canWrite(File outputFile) {
  		boolean fileIsValid = false;
  		if (outputFile.exists()) {
  			int result = JOptionPane.showConfirmDialog(
  					this, "File exists, overwrite?",
  					"Warning", JOptionPane.YES_NO_CANCEL_OPTION);
  			switch (result) {
  			case JOptionPane.YES_OPTION:
  				fileIsValid = true;
  				break;
  			default:
  				fileIsValid = false;
  			}
  		} else {
  			fileIsValid = true;
  		}
  		return fileIsValid;
  	}
docs: A utility method to check if the result should be written to the target file.
  Return true if the target file doesn't exist yet or the user allows overwriting.