Here you can find the source of getImage(final String name)
public static Image getImage(final String name)
//package com.java2s; //License from project: Apache License import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.io.File; import java.util.HashMap; import java.util.Map; public class Main { private static Map<String, ImageIcon> images = new HashMap<>(); public static Image getImage(final String name) { final ImageIcon icon = images.get(name); if (icon == null) { try { final ImageIcon image = new ImageIcon( ImageIO.read(new File(name))); images.put(name, image); return image.getImage(); } catch (Exception e) { return null; }/*from w w w . j ava2 s .co m*/ } return icon.getImage(); } }