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?



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.

References: 
 >why is JFileChooser so non-Mac-like? (From: Ivan Drucker <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.