Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why is JFileChooser so non-Mac-like?



Or you can use the AWT FileDialog class, which gives you a native file dialog with absolutely no such effort. Is there a particularly compelling reason people need to use JFileChooser if they're looking for a mac-like dialog? A FileDialog is a completely self-contained component and has no Swing-AWT-mixing repercussions.

http://java.sun.com/products/jfc/tsc/articles/mixing/index.html

md

On Friday, August 30, 2002, at 12:18 AM, Werner Randelshofer wrote:

There is a work around for the root level issue.

Write a subclass of javax.swing.filechooser.FileSystemView that wraps the
default FileSystemView. Let method getRoots() return all Files of the
"/Volumes" directory and let method isRoot() return true for all Files that
have the name "/" or are contained in the "/Volumes" directory.

Then write a javax.swing.filechooser.FileView that returns null in method
getName() if a File is a root file according to your FileSystemView subclass
and the File name is not equal to "".

Now you can create a file chooser using the following statements:

JFileChooser fileChooser;
fileChooser = new JFileChooser(OSXFileSystemView.getFileSystemView());
fileChooser.setFileView(new OSXFileView());


-Werner


Ivan Drucker wrote:
...
JFileChooser is pretty weird for a Mac user -- it even identifies the
root level as your machine name, which you never see anywhere else.
...
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: why is JFileChooser so non-Mac-like? (From: Werner Randelshofer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.