List of usage examples for javax.swing ImageIcon ImageIcon
public ImageIcon(byte[] imageData, String description)
From source file:Main.java
public static void main(String[] argv) throws Exception { File file = new File("filename.txt"); ShellFolder sf = ShellFolder.getShellFolder(file); Icon icon = new ImageIcon(sf.getIcon(true), sf.getFolderType()); }
From source file:components.LabelDemo.java
/** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path, String description) { java.net.URL imgURL = LabelDemo.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); } else {/*from w w w.ja v a2s . c om*/ System.err.println("Couldn't find file: " + path); return null; } }
From source file:com.validation.manager.core.tool.Tool.java
public static ImageIcon createImageIcon(String path, String description, Class relativeTo) { URL imgURL = relativeTo == null ? Tool.class.getResource(path) : relativeTo.getResource(path); return imgURL == null ? null : new ImageIcon(imgURL, description); }
From source file:SwingLabelDemo.java
/** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path, String description) { java.net.URL imgURL = SwingLabelDemo.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); } else {/*from w w w .ja va 2s . c om*/ System.err.println("Couldn't find file: " + path); return null; } }