FileDocCategorySizeDatePackage
TestFileView.javaAPI DocExample1206Sun Mar 28 19:08:42 BST 1999None

TestFileView

public class TestFileView extends FileView

Fields Summary
Constructors Summary
Methods Summary
public java.lang.StringgetDescription(java.io.File f)

    return "a description";
  
public javax.swing.IcongetIcon(java.io.File f)

  
    return null;
    
  
public java.lang.StringgetName(java.io.File f)

    
    String name = f.getName();
    int lastdot = name.lastIndexOf('.");
    if (lastdot == -1) return name;
    else return name.substring(0, lastdot);
    
  
public java.lang.StringgetTypeDescription(java.io.File f)

   
    String name = f.getName();
    int lastdot = name.lastIndexOf('.");
    if (lastdot != -1) return name.substring(lastdot+1);
    else return null;
    
  
public java.lang.BooleanisTraversable(java.io.File f)

    return null; 
  
public static voidmain(java.lang.String[] args)

      
    JFileChooser fc = new JFileChooser();
    fc.setFileView(new TestFileView());
    int result = fc.showOpenDialog(new JFrame());
    if (result == JFileChooser.APPROVE_OPTION) {
        File f = fc.getSelectedFile();
          if (f != null) {
            System.out.println(f);
          }
        
      }
      
      System.exit(0);