FileDocCategorySizeDatePackage
ThumbNailFileView.javaAPI DocExample2294Mon Nov 09 12:45:48 GMT 1998None

ThumbNailFileView

public class ThumbNailFileView extends FileView

Fields Summary
private Icon
fileIcon
private Icon
folderIcon
private Component
observer
Constructors Summary
public ThumbNailFileView(Component c)


     
    // we need a component around to create our icon's image
    observer = c;
  
Methods Summary
public java.lang.StringgetDescription(java.io.File f)

    // we won't store individual descriptions, so just return the
    // type description
    return getTypeDescription(f);
  
public javax.swing.IcongetIcon(java.io.File f)

    // 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;
  
public java.lang.StringgetName(java.io.File f)

    String name = f.getName();
    return name.equals("") ? f.getPath() : name;
  
public java.lang.StringgetTypeDescription(java.io.File f)

    String name = f.getName().toLowerCase();
    if (f.isDirectory()) { return "Folder"; }
    if (name.endsWith(".jpg")) { return "JPG Image"; }
    if (name.endsWith(".gif")) { return "GIF Image"; }
    return "Generic File";
  
public java.lang.BooleanisTraversable(java.io.File f)

    // we'll mark all directories as traversable
    return f.isDirectory() ? Boolean.TRUE : Boolean.FALSE;