/* */ package org.ui.icons; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; public class IconLoader { public static final char LOAD_ICON_CODE_POINT = 'a'; public static final char SAVE_ICON_CODE_POINT = 'b'; public static final char CLEAR_ICON_CODE_POINT = 'c'; public static final char STOP_ICON_CODE_POINT = 'd'; public static final char RUN_ICON_CODE_POINT = 'e'; public static final char RESET_ICON_CODE_POINT = 'f'; public static final char APPLY_ICON_CODE_POINT = 'g'; public static final char INFO_ICON_CODE_POINT = 'h'; public static final char OPTIONS_ICON_CODE_POINT = 'i'; private static final String FONT_FILE_NAME = "data/icons/RTX-GYTEBOT-ICONS.ttf"; private static final String ICON_FILE_NAME = "data/icons/gytebotIcon.png"; public static final void loadIcons() throws AssertionError { try { Font iconFont = Font.createFont(0, (IconLoader.class.getClassLoader().getResourceAsStream(FONT_FILE_NAME))); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(iconFont); } catch (FontFormatException e) { throw new AssertionError("Unable to register icon font"); } catch (Exception e) { throw new AssertionError("Unable to find or load icon font file:" + FONT_FILE_NAME); } } public static final BufferedImage loadWindowIcon() throws AssertionError { try { return ImageIO.read(IconLoader.class.getClassLoader().getResourceAsStream(ICON_FILE_NAME)); } catch (Exception e) { throw new AssertionError("Unable to find or load image file:" + ICON_FILE_NAME); } } }