// is it a folder?
if (f.isDirectory()) { return folderIcon; }
// ok, it's a file, so return a custom icon if it's an image file
String name = f.getName().toLowerCase();
if (name.endsWith(".jpg") || name.endsWith(".gif")) {
return new Icon16(f.getAbsolutePath());
}
// and return the generic file icon if it's not
return fileIcon;