title: JFileChooser - Custom file name (create new file)
body: <p>I may be missing something obvious in the <code>JFileChooser</code> API, but when I try and use a <code>JFileChooser</code> to save a file, I can only select pre-existing files to save to, not enter a new name and save to that. Is that even possible with a <code>JFileChooser</code> or should I be using a different API?</p>
  
  <p>I have this code to try and do what I'm attempting:</p>
  
  <pre><code>public static File getUserFile() {      
      final SaveFileChooser fc = new SaveFileChooser();
  
      fc.setAcceptAllFileFilterUsed(false);
  
      for(FileFilter ch : FileFilterUtils.getAllFilters()) {
          fc.addChoosableFileFilter(ch);
      }       
  
      int option = fc.showSaveDialog(JPad.getFrame());
  
      if (option == JFileChooser.APPROVE_OPTION) {
          return fc.getSelectedFile();
      } 
      return null;
  }
  
  public static class SaveFileChooser extends JFileChooser {
      private static final long serialVersionUID = -8175471295012368922L;
  
      @Override
      public void approveSelection() {
          File f = getSelectedFile();
          if(f.exists() &amp;&amp; getDialogType() == SAVE_DIALOG){
              int result = JOptionPane.showConfirmDialog(JPad.getFrame(), "The file exists, overwrite?", "Existing file", JOptionPane.YES_NO_CANCEL_OPTION);
  
              switch(result){
              case JOptionPane.YES_OPTION:
                  super.approveSelection();
                  return;
              case JOptionPane.NO_OPTION:
                  return;
              case JOptionPane.CLOSED_OPTION:
                  return;
              case JOptionPane.CANCEL_OPTION:
                  cancelSelection();
                  return;
              }
          }
      }
  }
  </code></pre>