/* * ResourceLoader.java * * Created on 2.2.2009 * */ package netukar.tinybrowser.ui.resources; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; /** * * @author Radovan Netuka */ public class ResourceLoader { private static File dir = new File("resources"); /** * Creates a new instance of ResourceLoader. */ private ResourceLoader() {} public static BufferedImage loadImage(String filename) { try { return ImageIO.read(new File(dir, filename)); } catch (IOException ex) { System.err.println(new File(dir, filename).getAbsolutePath()); ex.printStackTrace(); return null; } } public static ImageIcon loadIcon(String filename) { return new ImageIcon(loadImage(filename)); } }