/** * 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); } }
/** * 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; }