< prev index next >
src/demo/share/jfc/SwingSet2/ExampleFileView.java
Print this page
@@ -57,13 +57,13 @@
* 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);
+ 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,11 +83,11 @@
* A human readable description of the file.
*
* @see FileView#getDescription
*/
public String getDescription(File f) {
- return (String) fileDescriptions.get(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,11 +109,11 @@
* A human readable description of the type of the file.
*
* @see FileView#getTypeDescription
*/
public String getTypeDescription(File f) {
- return (String) typeDescriptions.get(getExtension(f));
+ return typeDescriptions.get(getExtension(f));
}
/**
* Convenience method that returns the "dot" extension for the
* given file.
@@ -147,11 +147,11 @@
*/
public Icon getIcon(File f) {
Icon icon = null;
String extension = getExtension(f);
if(extension != null) {
- icon = (Icon) icons.get(extension);
+ icon = icons.get(extension);
}
return icon;
}
/**
< prev index next >