コード例 #1
0
 public static Image getImage(String url) {
   try {
     url = url.replace('\\', '/');
     if (url.startsWith("/")) url = url.substring(1);
     if (resources.containsKey(url)) return (Image) resources.get(url);
     Image img =
         new Image(
             Display.getDefault(), instance.getClass().getClassLoader().getResourceAsStream(url));
     if (img != null) resources.put(url, img);
     return img;
   } catch (Exception e) {
     System.err.println("SWTResourceManager.getImage: Error getting image " + url + ", " + e);
     return null;
   }
 }