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: Preventing Package selection in JFileChooser



Donald Leeper wrote:

Is there a way (without JNI) to get JFileChooser to display
directories as not grayed out (traversable) and yet not allow the
selection of Packages? (I can filter on .app files to prevent
selecting Applications but is there a way to deal with Packages
generally?)

I use the method JFileChooser.isTraversable(File) in a file filter. There is a FileSystemView.isTraversable, but it returns TRUE for packages and non-package directories alike. Since JFileChooser.isTraversable(File) is not static, the file filter needs a reference back to the originating JFileChooser (well, it need not be the originating JFileChooser, I had to hack a couple of places where the original JFileChooser was not readily available, and using an arbitrary "new JFileChooser()" also works).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to 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.