JDK-6215240 : JFileChooser should provide API to control what happens when opening a non-existant file.
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0,6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2005-01-07
  • Updated: 2014-03-26
  • Resolved: 2014-03-26
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Currently, when one types in a non-existant file in a JFileChooser open dialog and chooses it, the filechooser simply returns the entered file name. It would be nice for filechooser to add API allowing the developer to specify alternate ways of dealing with this. Cases I can think of are:

1) Return the file name (current behavior)
2) Prompt that the file doesn't exist.
3) Prompt that the file doesn't exist and offer to create.

Another possibility is:

4) Prompt that the file doesn't exist and offer to create - but don't actually create the file. Apparently some editors show this behavior. They just use the returned file name to create a new buffer/document to be saved later.
###@###.### 2005-1-07 19:42:21 GMT

Comments
EVALUATION Great idea! For now, developers can deal with this themselves by overriding JFileChooser.approveSelection(). If they don't want the file chooser to return the file, they simply don't call super.approveSelection(). ###@###.### 2005-1-07 19:42:21 GMT
07-01-2005