Ejemplo n.º 1
0
  /**
   * Returns an internationalized string corresponding to the given key.
   *
   * @param key The key of the string.
   * @return An internationalized string corresponding to the given key.
   */
  public static String getString(String key) {
    try {
      return STRING_RESOURCE_BUNDLE.getString(key);

    } catch (MissingResourceException e) {
      return '!' + key + '!';
    }
  }
Ejemplo n.º 2
0
  /**
   * Loads an image from a given image identifier.
   *
   * @param imageID The identifier of the image.
   * @return The image for the given identifier.
   */
  public static ImageIcon getImage(String imageID) {
    BufferedImage image = null;

    String path = IMAGE_RESOURCE_BUNDLE.getString(imageID);

    try {
      image = ImageIO.read(Resources.class.getClassLoader().getResourceAsStream(path));
    } catch (IOException e) {
      log.error("Failed to load image:" + path, e);
    }

    return new ImageIcon(image);
  }