Results 1 to 4 of 4
Thread: FileFilter
- 03-04-2010, 03:06 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 20
- Rep Power
- 0
FileFilter
Hey, I created a filefilter for jfilechooser to show "jpg" files only
I did this code:
public boolean accept(File f) {
String s =f.getName();
return s.toLowerCase().endsWith(".jpg");
}
public String getDescription()
{ return "jpg image files"; }
};
The problem is that now jfilechooser is showing "jpg" files only :D.
I mean its not showing Folders as well, I want to show folders also. Plz help...:confused:
- 03-04-2010, 08:24 PM #2
In future, please use the code tags and not the italic tags to postcode.Java Code:return s.toLowerCase().endsWith(".jpg") || f.isDirectory();
db
- 03-06-2010, 05:17 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 20
- Rep Power
- 0
Thanks db for Solution and advise.
- 03-08-2010, 04:22 PM #4


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks