<AWT Dev> Possibility to add file and directory selection to FileDialog?

Anthony Petrov anthony.petrov at oracle.com
Wed Dec 28 02:48:45 PST 2011


Hi Paulo,

That's an interesting feature. However, as you've already noticed, this 
is a different native widget, and since AWT doesn't use the folder 
browser yet, I don't think we want to add support for it right now.

However, there's an RFE to implement a folder chooser: 
http://bugs.sun.com/view_bug.do?bug_id=6927978 . Perhaps the mode for 
selecting both files and directories could be added to the new 
DirectoryDialog in the future (provided all platforms support this feature).

We already have a fix that covers X11 platform (see the bug report for 
details). If you wish to help with Windows implementation, it will be 
greatly appreciated!

--
best regards,
Anthony

On 12/27/2011 10:31 PM, Paulo Levi wrote:
> Hi Anthony.
> 
> This answer: 
> http://stackoverflow.com/questions/428410/select-either-a-file-or-folder-from-the-same-dialog-in-net
> 
> Seems to indicate it's possible if you go beyond the public api. Maybe a 
> SystemProperty?
> 
> It would have to work on all platforms though :\
> 
> I know apple has a similar property
> "|apple.awt.fileDialogForDirectories| 
> <http://developer.apple.com/documentation/Java/Reference/Java%5FPropertiesRef/Articles/JavaSystemProperties.html>"
> 
> But i don't know if is both (what's needful) or only directories.
> 
> On Tue, Dec 27, 2011 at 11:09 AM, Anthony Petrov 
> <anthony.petrov at oracle.com <mailto:anthony.petrov at oracle.com>> wrote:
> 
>     Hi Paulo,
> 
>     The native FileDialog on MS Windows doesn't support choosing both
>     files and directories simultaneously (at least on Windows XP and
>     earlier.) Thus we can't provide this functionality as a
>     platform-independent feature at this time.
> 
>     Please use JFileChooser for this purpose.
> 
>     --
>     best regards,
>     Anthony
> 
>     On 12/27/2011 11:29 AM, Paulo Levi wrote:
> 
>         JFileChooser has it's well known limitations. So i was overjoyed
>         in finding out that java 7 filedialog in GTK was using the
>         native widget like macosx.
> 
>         Well, long story short is that my app has to choose both files
>         and directories. Directories are used to "mass import", and
>         files to singly import.
> 
>         Not having the ability to add files impedes using FileDialog.
>         What's the story behind that limitation of "Only Files" and
>         could it be reconsidered? I doubt java even installs on the
>         windows version where that was a requirement to use the native
>         file chooser.
> 
> 
> 
> 
>         Please don't tell me to use JFileChooser. :\
> 
> 



More information about the awt-dev mailing list