apple.awt.fileDialogForDirectories property not working. (original) (raw)
niagarasoft20-macosxportdev at yahoo.com niagarasoft20-macosxportdev at yahoo.com
Mon May 28 08:03:06 PDT 2012
- Previous message: apple.awt.fileDialogForDirectories property not working.
- Next message: apple.awt.fileDialogForDirectories property not working.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Marco,
I did file a bug for this and it was placed on the back burner. See here.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7161437
I personally feel this is a mistake, as it does not take into consideration the special mac FileDialog features that would be left out, creating an obvious platform specific UI hole.
Aside from personally hacking the awt.FileDialog file, I see no other recourse but to use the JFileChooser as a work-around which frankly does not work as well on the mac as is quite lame.
Regards, Mike
From: Marco Dinacci <marco.dinacci at gmail.com> To: macosx-port-dev Port OS X <macosx-port-dev at openjdk.java.net> Sent: Monday, May 28, 2012 10:36 AM Subject: apple.awt.fileDialogForDirectories property not working.
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
- Previous message: apple.awt.fileDialogForDirectories property not working.
- Next message: apple.awt.fileDialogForDirectories property not working.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]