Ejemplo n.º 1
0
 /**
  * Returns the specified image.
  *
  * @param url image url
  * @return image
  */
 public static Image get(final URL url) {
   try {
     return ImageIO.read(url);
   } catch (final IOException ex) {
     throw Util.notExpected(ex);
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns the image url.
  *
  * @param name name of image
  * @return url
  */
 private static URL url(final String name) {
   final String path = "/img/" + name + ".png";
   URL url = BaseXImages.class.getResource(path);
   if (url == null) {
     Util.stack("Image not found: " + path);
     url = BaseXImages.class.getResource("/img/warn.png");
   }
   return url;
 }