title: JFileChooser: Save the last directory user navigates to before cancelling
body: <p>I'm using JFileChooser to open up a dialog box for a user to open a file. I've already set the current directory if the user actually selects a file:</p>
  
  <pre><code>int returnVal = fc.showOpenDialog(frame);
  if (returnVal == JFileChooser.APPROVE_OPTION) {
      File newfile = fc.getSelectedFile();
  
      //set the default directory to this file's directory
      fc.setCurrentDirectory(newfile.getParentFile());
  }
  else {
      //User cancels file chooser. How to still set the current directory
      //to the one they were last in?
  }
  </code></pre>
  
  <p>However, even if the user cancels the dialog box (e.g. they decide they want to do something else in the program before choosing a file), I want to save the last directory they were in so they avoid the hassle of finding that directory again. Is this possible at all?</p>