Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

FileDialog: option to select both files AND directories?

843807Sep 21 2010 — edited Sep 23 2010
Hi,

For the sake of Mac users I wish to use FileDialog for file/directory selection. I can use:

System.setProperty(apple.awt.fileDialogForDirectories, true)

in order to be able to select directories, but it only allows directory selection. Not setting it only allows file selection. I wish to be able to select either a file OR a directory, which I haven't found a way to do with FileDialog.

Anyone know how?

thanks, Allasso

Comments

darrylburke
Cross posted
[http://www.coderanch.com/t/511018/GUI/java/FileDialog-select-both-files-directories]

db
843807
My apologies for lack of etiquette...

[http://www.coderanch.com/t/511018/GUI/java/FileDialog-select-both-files-directories#2311426|http://www.coderanch.com/t/511018/GUI/java/FileDialog-select-both-files-directories#2311426]

Edited by: AllassoMT on Sep 22, 2010 7:44 AM
User_64CKJ
I note that on the cross-post you reject JFileChooser because it does not display files/directories in the form the Mac user expects. Does that behavior also affect a JFC using the System PLAF?
843807
Yes Sir. While it has the look and feel of Aqua, it does not have the behaviour ("column view") to which so many Mac users are accustomed. This is why it is (apparently) fairly common for Mac-conscious developers to detect the System OS, and use FileDialog for Macs, otherwise use JFileChooser, such as this:

[http://lists.apple.com/archives/java-dev/2010/May/msg00149.html|http://lists.apple.com/archives/java-dev/2010/May/msg00149.html]
843807
It would appear that there isn't a way to make FileDialog behave in the way I would like.

I am marking this question as answered.

Thanks all.

Allasso
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 21 2010
Added on Sep 21 2010
5 comments
3,039 views