trex.GUI.ImageChooser
Class ImageFileView

java.lang.Object
  |
  +--javax.swing.filechooser.FileView
        |
        +--trex.GUI.ImageChooser.ImageFileView

public class ImageFileView
extends FileView

This class implements a file view for application's "load" and "save" dialogs. It connects gif, jpg and png files. Please note that png is the preferred file format for saving images, as gif is only 8bit color depth and jpg is lossy.

This class was mostly stolen from Sun's documentation: FileChooser Demo (whoops... does this hurt GPL?!)

Version:
$Revision: 1.7 $
Author:
Bastian Friedrich <bastian@bastian-friedrich.de>

Constructor Summary
ImageFileView()
           
 
Method Summary
 String getDescription(File f)
          Return a description for the file.
 Icon getIcon(File f)
          Return an icon for the file.
 String getName(File f)
          Return file's name.
 String getTypeDescription(File f)
          Return a description for the file type.
 Boolean isTraversable(File f)
          Whether this directory is traversable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageFileView

public ImageFileView()
Method Detail

getName

public String getName(File f)
Return file's name. Unneeded - returning null.

Overrides:
getName in class FileView
Parameters:
f - file.
Returns:
null.

getDescription

public String getDescription(File f)
Return a description for the file. Unneeded - returning null.

Overrides:
getDescription in class FileView
Parameters:
f - file.
Returns:
null.

isTraversable

public Boolean isTraversable(File f)
Whether this directory is traversable. Let the GUI identify this.

Overrides:
isTraversable in class FileView
Parameters:
f - file
Returns:
null.

getTypeDescription

public String getTypeDescription(File f)
Return a description for the file type. A description is derived from the suffix, plainly identifying the file type.

Overrides:
getTypeDescription in class FileView
Parameters:
f - file to return type description for
Returns:
A file description derived from file suffix.

getIcon

public Icon getIcon(File f)
Return an icon for the file. The icon is plainly chosen according to file's suffix.

Overrides:
getIcon in class FileView
Parameters:
f - file to return an icon for
Returns:
Icon derived from file suffix.