Here you can find the source of getFolderIcon()
public static Icon getFolderIcon()
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.HashMap; import java.util.Map; import javax.swing.Icon; import javax.swing.filechooser.FileSystemView; public class Main { /**/*from w w w . j a v a 2 s . co m*/ * Cache of file icons */ private static final Map<String, Icon> CACHE = new HashMap<String, Icon>(); /** * Gets system default folder icon * @return */ public static Icon getFolderIcon() { Icon icon; if (CACHE.containsKey("file-dir")) { icon = CACHE.get("file-dir"); } else { File temp = new File(System.getProperty("java.io.tmpdir") + File.separator + "icon"); temp.mkdirs(); icon = FileSystemView.getFileSystemView().getSystemIcon(temp); CACHE.put("file-dir", icon); temp.delete(); } return icon; } }