public Image createImage(String filename) { if (BDJXletContext.getCurrentContext() == null) { logger.error("createImage(): no context " + Logger.dumpStack()); } if (!new File(filename).isAbsolute()) { String home = BDJXletContext.getCurrentXletHome(); if (home != null) { String homeFile = home + filename; if (new File(homeFile).exists()) { logger.warning("resource translated to " + homeFile); filename = homeFile; } else { logger.error("resource " + homeFile + " does not exist"); } } } ImageProducer ip = new FileImageSource(filename); Image newImage = createImage(ip); return newImage; }
static Image getImageFromHash(Toolkit tk, String filename) { checkPermissions(filename); synchronized (fileImgCache) { Image img = (Image)fileImgCache.get(filename); if (img == null) { try { img = tk.createImage(new FileImageSource(filename)); fileImgCache.put(filename, img); } catch (Exception e) { } } return img; } }
@Override public Image createImage(String filename) { checkPermissions(filename); return createImage(new FileImageSource(filename)); }
public HBackgroundImage(String filename) { producer = new FileImageSource(filename); img = Toolkit.getDefaultToolkit().createImage(producer); }