
{filelink=7977}
import java.io.File;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class IconFichier
{
/*
* Ce programme affiche le type d'un fichier
* et son icône
*/
public static void main(String[] args) throws Exception {
File file = new File("c:/test.txt");
sun.awt.shell.ShellFolder sf = sun.awt.shell.ShellFolder.getShellFolder(file);
Icon icon = new ImageIcon(sf.getIcon(true));
System.out.println("Type de Fichier = " + sf.getFolderType());
JOptionPane.showMessageDialog(null, icon);
}
}