title: How to avoid .getSelectedFile() premature selection?
body: <p>It appears that the .getSelectedFile() functions will still choose a folder from a file chooser even after choosing the cancel option. Is there a different function? Like getOpenedFolder(), maybe? I would appreciate any help. Here is my code: <br/></p>
  <pre><code>        boolean flag = false;
          fc.setCurrentDirectory(new java.io.File(&quot;C:/Users/michaelartichoke/Desktop&quot;));
          fc.setDialogTitle(&quot;PDF Manager&quot;);
          fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          fc.showOpenDialog(null);
          
          chosenfolder = fc.getSelectedFile();
          try{
              folderpath = chosenfolder.getAbsolutePath();
              flag = true;
          } catch(Exception e){
              //
          }
          
          if(flag!=false){
              selecting();
          }
  </code></pre>
  <p>FYI, selecting() is the command that creates the database.</p>