In windows explorer (and linux gnome) shows for each file a thumbnail or icon. Like with EXEs, images, videos, txt-files, ini-files, Word documents and so m
If you are looking for a plattform-independent (i.e. pure java) solution, hava a look at JavaThumbnailer. It's still beta, though, and has a limited number of supported file types.
It looks like there is no AWT way of doing this.
If you're using Swing, there is a method you can use to get a Swing Icon...
import javax.swing.filechooser.FileSystemView;
import javax.swing.Icon;
...
Icon ico = FileSystemView.getFileSystemView().getSystemIcon(file);
You can also convert that Icon
back into an Image
(most likely a BufferedImage, but I haven't tested it):
Image image = ((ImageIcon) ico).getImage();
There is also a class to get the icon directly, but this class is JDK dependent. On Sun JDK's it's the sun.awt.shell.ShellFolder
class.
If you're using SWT, things are a bit trickier.
Not entirely sure if you will be able to get the icon but take a look at AssociationService
that is accessible using JDIC.
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/jdic_assoc/
Also this thread http://forums.sun.com/thread.jspa?threadID=5357995
I don't think the answers above are addressing the right question. Martijn isn't asking for the API for manipulating icon images. He wants to know how to get to the desktop's cache of thumbnail images for items in the browsable filesystem.
I don't think there's a portable way to do this at all, but the Linux world (Gnome and KDE) adhere to the Freedesktop thumbnail standard which can be read at: http://jens.triq.net/thumbnail-spec/
There may be code, perhaps in Gtk (but probably not Java) that implements a compatibility layer for windows, but I'm not aware of it if there is.