5

Here's my problem. I have a Java application that runs on MacOS X. Right now I'm trying to make this application available on the Mac App Store. Unfortunately, Apple always reject my application because I'm not using the native FileDialog to access files and directories. In some cases the user has to select files in other he has to select directories. Here's what I've tried to create a directory chooser:

// Go in directory chooser mode
System.setProperty("apple.awt.fileDialogForDirectories", "true");
FileDialog dialog = new FileDialog(tamaggoApp.getFrame());
dialog.setDirectory(defaultDir);
dialog.setVisible(true);

// Set back the property to file chooser.
System.setProperty("apple.awt.fileDialogForDirectories", "false");

Unfortunately, it doesn't work for me. It seems that this property has to be set in the main() method so you can't toggle between file and directory choose. Using Swing JFileChooser is not an option since Apple will reject it (I tried).

5
  • Did you check the randelshofer.ch/quaqua look and feel? It advertises native experience on the Mac.
    – Rekin
    Commented May 9, 2013 at 14:01
  • 1
    I think this is the bug report: bugs.sun.com/view_bug.do?bug_id=7161437 Commented May 9, 2013 at 15:41
  • I saw that... the problem is that I got the latest 1.7 build and unfortunately it's not fixed. Also, I saw in the bug that the fix version is 8 so I wonder if this is referring to update 8 or 1.8 version of Java.
    – iDev
    Commented May 9, 2013 at 17:05
  • The aqua look and feel is not good enough for Apple. You cannot use the column display which is widely used. Also, in the rejection message Apple wrote that we have to use the native file dialog.
    – iDev
    Commented May 9, 2013 at 17:30
  • @iDev If worse comes to worst, maybe you can call the actual native, Cocoa file dialog via JNI. Since all you need to pass is a string (the path). Commented May 9, 2013 at 17:51

1 Answer 1

0

I finally figured out that it was working all the time with jdk1.7u21. The problem is you can select a directory but you still can choose files also. I will have to find a way to avoid that which doesn't seem to be easy when I look in forums.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.