This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,899 Users
  • 2,269,649 Discussions


FileDialog: option to select both files AND directories?

843807 Member Posts: 46,582
edited Sep 23, 2010 10:40AM in Abstract Window Toolkit (AWT)

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


  • darrylburke
    darrylburke Member Posts: 18,007
    Cross posted

  • 843807
    843807 Member Posts: 46,582
    edited Sep 22, 2010 10:45AM
    My apologies for lack of etiquette...


    Edited by: AllassoMT on Sep 22, 2010 7:44 AM
  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    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
    843807 Member Posts: 46,582
    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:

  • 843807
    843807 Member Posts: 46,582
    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.

This discussion has been closed.