apple.awt.fileDialogForDirectories property not working.
Anthony Petrov
anthony.petrov at oracle.com
Mon May 28 08:07:26 PDT 2012
Hi Marco,
This is a known issue: 7161437. Although it is closed as a duplicate of
a more general AWT RFE 6927978 that proposes to add public API for
DirectoryDialogs to AWT.
--
best regards,
Anthony
On 05/28/12 18:36, 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