List of usage examples for java.awt Window setIconImage
public void setIconImage(Image image)
From source file:Main.java
/** * Set the icon if a window./*from w ww . j a v a2 s .c o m*/ * * @param window Window to change the icon of. * @param imageInputStream Input stream of the image. */ public static void setWindowIcon(Window window, InputStream imageInputStream) { try { // Load the image and set the window icon window.setIconImage(ImageIO.read(imageInputStream)); } catch (IOException | NullPointerException e) { System.out.println("Failed to set window icon."); } }
From source file:org.tros.torgo.Main.java
public static void loadIcon(Window frame) { try {/*from w ww . j a v a 2 s . co m*/ java.util.Enumeration<URL> resources = ClassLoader.getSystemClassLoader() .getResources(IMAGE_ICON_CLASS_PATH); ImageIcon ico = new ImageIcon(resources.nextElement()); frame.setIconImage(ico.getImage()); } catch (IOException ex) { org.tros.utils.logging.Logging.getLogFactory().getLogger(Main.class).warn(null, ex); } }