apple.awt.fileDialogForDirectories property not working.

niagarasoft20-macosxportdev at yahoo.com niagarasoft20-macosxportdev at yahoo.com
Tue May 29 06:52:10 PDT 2012


Marco,

Please file this as a  bug . The user should be able to choose their own directory on a mac when using the JFileChooser. If this is the case, it's pretty serious problem.


Regards
Mike




>________________________________
> From: Marco Dinacci <marco.dinacci at gmail.com>
>To: "niagarasoft20-macosxportdev at yahoo.com" <niagarasoft20-macosxportdev at yahoo.com> 
>Cc: macosx-port-dev Port OS X <macosx-port-dev at openjdk.java.net> 
>Sent: Monday, May 28, 2012 11:39 AM
>Subject: Re: apple.awt.fileDialogForDirectories property not working.
> 
>Hi,
>
>JFileChooser doesn't use a native dialog so it won't be able to list
>any directory except I guess for the container
>(~/Library/Containers/myapp/Data) and any special directories listed
>in the entitlements file.
>
>I just bundled and signed an app with the code below  the result is a
>JFileChooser listing my home directory and not showing any icon:
>
>mport javax.swing.JFrame;
>import java.io.File;
>import javax.swing.JFileChooser;
>
>public  class FileChooserTest extends JFrame {
>
>    public String selectFolder() {
>      JFileChooser chooser = new JFileChooser(System.getProperty("user.home"));
>      chooser.showOpenDialog(this);
>      //chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
>      return chooser.getSelectedFile().getAbsolutePath();
>
>    }
>
>    public static void main(String[] args) {
>        System.setProperty("apple.awt.fileDialogForDirectories", "true");
>
>        FileChooserTest fdt = new FileChooserTest();
>        String selectedFolder = fdt.selectFolder();
>
>        System.out.println("The selected file was: " + selectedFolder);
>
>        System.setProperty("apple.awt.fileDialogForDirectories", "false");
>        System.exit(0);
>    }
>
>}
>
>
>Best,
>Marco
>
>
>On 28 May 2012 16:23, niagarasoft20-macosxportdev at yahoo.com
><niagarasoft20-macosxportdev at yahoo.com> wrote:
>> Hi Marco,
>>
>> Can you clarify the sandbox issue?
>>
>> Mike
>>
>> It's worse than that, the JFileChooser won't work if the application
>> is in a sandbox so I can't use it.
>>
>> Which leaves as only solution hacking the awt.FileDialog...
>>
>
>
>


More information about the macosx-port-dev mailing list