< prev index next >

src/demo/share/jfc/SwingSet2/ExampleFileView.java

Print this page

        

*** 57,69 **** * chooser.setFileView(fileView); * * @author Jeff Dinkins */ public class ExampleFileView extends FileView { ! private Hashtable icons = new Hashtable(5); ! private Hashtable fileDescriptions = new Hashtable(5); ! private Hashtable typeDescriptions = new Hashtable(5); /** * The name of the file. Do nothing special here. Let * the system file view handle this. * @see FileView#getName --- 57,69 ---- * chooser.setFileView(fileView); * * @author Jeff Dinkins */ public class ExampleFileView extends FileView { ! private Hashtable<String, Icon> icons = new Hashtable<>(5); ! private Hashtable<File, String> fileDescriptions = new Hashtable<>(5); ! private Hashtable<String, String> typeDescriptions = new Hashtable<>(5); /** * The name of the file. Do nothing special here. Let * the system file view handle this. * @see FileView#getName
*** 83,93 **** * A human readable description of the file. * * @see FileView#getDescription */ public String getDescription(File f) { ! return (String) fileDescriptions.get(f); }; /** * Adds a human readable type description for files. Based on "dot" * extension strings, e.g: ".gif". Case is ignored. --- 83,93 ---- * A human readable description of the file. * * @see FileView#getDescription */ public String getDescription(File f) { ! return fileDescriptions.get(f); }; /** * Adds a human readable type description for files. Based on "dot" * extension strings, e.g: ".gif". Case is ignored.
*** 109,119 **** * A human readable description of the type of the file. * * @see FileView#getTypeDescription */ public String getTypeDescription(File f) { ! return (String) typeDescriptions.get(getExtension(f)); } /** * Convenience method that returns the "dot" extension for the * given file. --- 109,119 ---- * A human readable description of the type of the file. * * @see FileView#getTypeDescription */ public String getTypeDescription(File f) { ! return typeDescriptions.get(getExtension(f)); } /** * Convenience method that returns the "dot" extension for the * given file.
*** 147,157 **** */ public Icon getIcon(File f) { Icon icon = null; String extension = getExtension(f); if(extension != null) { ! icon = (Icon) icons.get(extension); } return icon; } /** --- 147,157 ---- */ public Icon getIcon(File f) { Icon icon = null; String extension = getExtension(f); if(extension != null) { ! icon = icons.get(extension); } return icon; } /**
< prev index next >