Questions about Sandboxed apps

Marco Dinacci marco.dinacci at gmail.com
Thu Sep 27 07:00:37 PDT 2012


Hi,

> Of course this probably relies on the Open / Save dialog being opened via
> appropriate native routines. What about if I use a javax.swing.JFileChooser?
> How about java.awt.FileDialog?

the JFileChooser doesn't work in a sandboxed environment, don't use
it. Unless you limit it to browse only the container directory where
your application is stored (~/Library/Containers/yourapp/...).

Use a FileDialog instead, which internally uses NSOpenPanel and
NSSavePanel, and if you need to select a directory, set the
fileDialogForDirectories property to true. Ex.

System.setProperty("apple.awt.fileDialogForDirectories", "true");
<FileDialog code>
System.setProperty("apple.awt.fileDialogForDirectories", "false");

Best,
Marco


More information about the macosx-port-dev mailing list