United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8000430 : [macosx] Add directories selection support in the java.awt.FileDialog

Details
Type:
Enhancement
Submit Date:
2012-09-26
Status:
Closed
Updated Date:
2013-04-02
Project Name:
JDK
Resolved Date:
2012-10-18
Component:
client-libs
OS:
os_x
Sub-Component:
java.awt
CPU:
Priority:
P4
Resolution:
Duplicate
Affected Versions:
Fixed Versions:

Related Reports
Duplicate:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
* Oracle's own update to java.awt.FileDialog is unfortunately still too limited for our needs. Although it now supports multiple file selection, one can't select directories as well and it doesn't allow drag and drop either.

* Calling getGraphicsConfiguration().getDevice().setFullScreenWindow(this); where "this" is a JFrame instance, as we do in our full screen slide show mode seems to cause a core dump:

2012-09-26 12:23:18.721 java[10122:8b13] Cocoa AWT: Not running on AppKit thread 0 when expected. (
0   liblwawt.dylib                      0x000000019bf7a50f Java_sun_lwawt_macosx_CPlatformWindow_nativeGetNSWindowDisplayID_1AppKitThread + 59
1   ???                                 0x00000001108aff90 0x0 + 4572512144
2   ???                                 0x00000001108a42d4 0x0 + 4572463828
3   ???                                 0x00000001108a49e1 0x0 + 4572465633
)
2012-09-26 12:23:18.722 java[10122:8b13] 	Please file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.


Attach the source code for a full screen slide show. It's a rather short piece of code and can be stripped down to a minimal reproduceable case. 

Work around this case by checking for Java 7 for Mac and simply ignoring calling getGraphicsConfiguration().getDevice().setFullScreenWindow(this)




                                    

Comments
Mac OSX specific issue.
                                     
2012-09-27
I have create a separated issue for the  JVM crashing after invoking  graphicsDevice.setFullScreenWindow(frame) method:
JDK-8000276 [macosx] graphicsDevice.setFullScreenWindow(frame) crashes JVM


The Drag and Drop from JFileChooser is described in issue:
JDK-7149041 [macosx] Aqua LaF: cannot start DnD session from a JFileChooser


The FileDialog allows only files selection.
The JFileChooser class should be used for the files and/or directories selection.

                                     
2012-10-01
The the JVM crash and Drag and Drop are described in the related issues.
The FileDialog does not allow to select directories. JFileChooser should be used instead.
                                     
2012-10-16
Feedback from a CAP member -

Really sad to hear that. The native file dialog (on Mac) does support the selection of directories as well as ordinary files. It would really be beneficial to have access to this fuctionality within Java too. JFileChooser is and will likely be too far from the native experience that users expect from commercial quality software. JFileChooser isn't simply an option for us as we know how end users frown when they see it. Swing is good, but JFileChooser is bad for Java's reputation!
                                     
2012-10-17
The directories selection in FileDialog for Mac OS X  by the "apple.awt.fileDialogForDirectories" system property  has been added to the JDK 7u12 and JDK 8 (see JDK-7161437).

See also Integration with the Native Application Environment: http://developer.apple.com/library/mac/#documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html
------------------------------------------------
apple.awt.fileDialogForDirectories
    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. 
------------------------------------------------

                                     
2012-10-18



Hardware and Software, Engineered to Work Together