JDK-4151536 : JFileChooser should allow traversable but unacceptable directories
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 1998-06-23
  • Updated: 2014-03-21
  • Resolved: 2014-03-21
Related Reports
Relates :  
Description
I would like to use JFileChooser to do the following:

	* Make all directories navigable
	* Make only some files/directories acceptable (via
	  the accept() method of FileFilter)

Currently, this is impossible without overriding some swing code.
For example, BasicDirectoryModel calls accept() on all files, before 
asking directories whether they are traversable.  So, a directory 
cannot be traversable and unacceptable.

This would make the file chooser much more useful!

Comments
EVALUATION Problem verified, it remains in merlin beta. leif.samuelsson@Eng 2001-04-04 FileFilter clearly documents that it is to be used to keep files from being "displayed" in the file list. The meaning of accept therefore cannot be changed. However, it is possible that we could add API to allow the developer to indicate whether or not a particular file can be "chosen" by the file chooser. This is an interesting idea and worthy of tracking - therefore, I'm moving this to an RFE. As far as the developer implementing this behavior, they should be able to do so easily. They should override JFileChooser.approveSelection(). In this method, they can a) call super.approveSelection() if they want to allow the directory to be accepted, b) call setCurrentDirectory() with the chosen directory if they want to instead traverse the directory, c) return immediately if they want to do nothing. ###@###.### 2005-1-07 19:33:59 GMT
07-01-2005