| |
e902. Getting the Large File-Type Icon of a File
This example uses an unsupported class - - sun.awt.shell.ShellFolder - - and therefore will not work in all virtual machines.
// Create a File instance of the file
File file = new File("filename.txt");
try {
sun.awt.shell.ShellFolder sf = sun.awt.shell.ShellFolder.getShellFolder(file);
// Get large icon
Icon icon = new ImageIcon(sf.getIcon(true), sf.getFolderType());
} catch (FileNotFoundException e) {
}
e901.
Getting the File-Type Icon of a File
© 2002 Addison-Wesley.
|