apple.awt.fileDialogForDirectories property not working.
Artem Ananiev
artem.ananiev at oracle.com
Wed May 30 04:29:08 PDT 2012
Hi, Marco,
although the bug (7161437) is now targeted to 7u8, please, bear in mind
that the property will not become officially supported anyway. For
example, it may or may not be removed in later JDK versions after we
have provided public API for directory choosers (6927978).
We at Oracle do our best to support all Java apps on Mac OS X that were
written for Apple's JDK6 and relied on Apple's extensions (system
properties, command line args, com.apple classes, etc.), but we don't
provide any official support for anything except public APIs.
Thanks,
Artem
On 5/28/2012 6:36 PM, Marco Dinacci wrote:
> Hi,
>
> the apple.awt.fileDialogForDirectories property is not honoured
> neither with OpenJDK nor with Oracle JDK 7u4.
> The following program will work with Java 6 but not with the above
> mentioned distributions:
>
> import java.awt.FileDialog;
> import java.io.File;
> import javax.swing.JFrame;
>
> public class FileDialogTest extends JFrame {
>
> public String selectFolder() {
> FileDialog fd = new FileDialog(this, "Select Folder Test",
> FileDialog.LOAD);
> fd.setDirectory(System.getProperty("user.home"));
> fd.setLocation(50,50);
> fd.setVisible(true);
>
> return fd.getFile();
> }
>
> public static void main(String[] args) {
> System.setProperty("apple.awt.fileDialogForDirectories", "true");
>
> FileDialogTest fdt = new FileDialogTest();
> String selectedFolder = fdt.selectFolder();
>
> System.out.println("The selected file was: " + selectedFolder);
>
> System.setProperty("apple.awt.fileDialogForDirectories", "false");
> System.exit(0);
> }
>
> }
>
> The expected result is to be able to select a directory, the actual
> result is that the file chooser enter the directory.
>
> The Apple documentation states:
>
> By default, the AWT File Dialog lets you choose a file. Under certain
> circumstances, however, it may be proper for you to choose a directory
> instead. If that is the case, set this property to allow for directory
> selection in a file dialog.
>
> The default value is false.
>
>
> Shall I file a bug ?
>
> Best,
> Marco
More information about the macosx-port-dev
mailing list