Results 1 to 3 of 3
- 02-14-2011, 01:34 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 45
- Rep Power
- 0
Jfilechooser removing all file types
Hi,
I've created a Jfilechooser and created my own class which implements the FileFilter interface.
Pretty much this only lets files of type ".save" which are my saved files be seen when the jfilechooser is opened. However when opened in the drop down box theres still an option to choose "all files". Is there any way to remove this so only my filter is shown?
I've looked on the net but only found sources of the filter stuff that I've already done.
My code for the Jfilechooser is here:
The SaveFileFilter class I wrote just uses the accept and getDescription method from the interface which only lets ".save" files be shown.Java Code:JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog(this); chooser.addChoosableFileFilter(new SaveFileFilter());
Thanks in advance
- 02-14-2011, 01:42 AM #2
Member
- Join Date
- Mar 2009
- Posts
- 70
- Rep Power
- 0
I'm not sure, but you may need to do chooser.setFileFilter, to only have yours in effect. This will also remove the visibility of folders, you have to explicitly handle that (check file.isDirectory()).
- 02-15-2011, 10:55 AM #3
Member
- Join Date
- Mar 2009
- Posts
- 45
- Rep Power
- 0
Similar Threads
-
[JFileChooser] File name to list
By Che999po in forum AWT / SwingReplies: 8Last Post: 07-30-2010, 10:09 PM -
Saving to file from JFileChooser SaveDialog
By kieran82 in forum AWT / SwingReplies: 2Last Post: 03-16-2010, 03:09 AM -
removing the last blank line from txt file
By heartysnowy in forum New To JavaReplies: 6Last Post: 11-04-2009, 07:15 PM -
how to use JFileChooser to select file -> string
By gezzel in forum AWT / SwingReplies: 15Last Post: 10-23-2008, 05:34 AM -
how to use JFileChooser to select file -> string
By gezzel in forum New To JavaReplies: 9Last Post: 09-18-2008, 09:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks