Package net.sf.gridarta.utils
Class ResourceIcons
- java.lang.Object
-
- net.sf.gridarta.utils.ResourceIcons
-
public class ResourceIcons extends java.lang.ObjectCreatesImageIconinstances from resources. The returned image icons are cached.
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.StringAPP_ICONApplication icon definitions (icon-dir).static @NotNull java.lang.StringAUTO_RUN_SMALL_ICONstatic @NotNull java.lang.StringCLOSE_TAB_SMALL_ICONstatic @NotNull java.lang.StringDEFAULT_ICONThe default map icon to use if no icon can be created.static @NotNull java.lang.StringDEFAULT_PREVIEWThe default map preview to use if no icon can be created.static @NotNull java.lang.StringFILTER_SMALL_ICONstatic @NotNull java.lang.StringRUN_PLUGIN_SMALL_ICONstatic @NotNull java.lang.StringSQUARE_CURSORstatic @NotNull java.lang.StringSQUARE_EMPTYstatic @NotNull java.lang.StringSQUARE_NO_ARCHstatic @NotNull java.lang.StringSQUARE_NO_FACEstatic @NotNull java.lang.StringSQUARE_PRE_SELECTED_SQUAREstatic @NotNull java.lang.StringSQUARE_SELECTED_SQUAREstatic @NotNull java.lang.StringSQUARE_SELECTED_SQUARE_EASTstatic @NotNull java.lang.StringSQUARE_SELECTED_SQUARE_NORTHstatic @NotNull java.lang.StringSQUARE_SELECTED_SQUARE_SOUTHstatic @NotNull java.lang.StringSQUARE_SELECTED_SQUARE_WESTstatic @NotNull java.lang.StringSQUARE_UNKNOWNstatic java.lang.StringSQUARE_WARNINGstatic java.lang.StringSYSTEM_DIRThe directory that contains the system icons.static @NotNull java.lang.StringTREASURE_LISTstatic @NotNull java.lang.StringTREASURE_NOstatic @NotNull java.lang.StringTREASURE_YESstatic @NotNull java.lang.StringTREASUREONE_LIST
-
Constructor Summary
Constructors Constructor Description ResourceIcons()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToCache(@NotNull java.lang.String name, @NotNull javax.swing.ImageIcon imageIcon)Add an image to the cache.@NotNull javax.swing.ImageIcongetLightSquareIcon()Returns theImageIconfor highlighting map squares that are affected by nearby light emitting game objects.@NotNull javax.swing.ImageIcongetResourceIcon(@NotNull java.lang.String iconName)Returns the image icon for the given icon name.@NotNull javax.swing.ImageIcongetWarningSquareIcon()
-
-
-
Field Detail
-
SYSTEM_DIR
public static final java.lang.String SYSTEM_DIR
The directory that contains the system icons.- See Also:
- Constant Field Values
-
SQUARE_SELECTED_SQUARE
@NotNull public static final @NotNull java.lang.String SQUARE_SELECTED_SQUARE
- See Also:
- Constant Field Values
-
SQUARE_SELECTED_SQUARE_NORTH
@NotNull public static final @NotNull java.lang.String SQUARE_SELECTED_SQUARE_NORTH
- See Also:
- Constant Field Values
-
SQUARE_SELECTED_SQUARE_EAST
@NotNull public static final @NotNull java.lang.String SQUARE_SELECTED_SQUARE_EAST
- See Also:
- Constant Field Values
-
SQUARE_SELECTED_SQUARE_SOUTH
@NotNull public static final @NotNull java.lang.String SQUARE_SELECTED_SQUARE_SOUTH
- See Also:
- Constant Field Values
-
SQUARE_SELECTED_SQUARE_WEST
@NotNull public static final @NotNull java.lang.String SQUARE_SELECTED_SQUARE_WEST
- See Also:
- Constant Field Values
-
SQUARE_PRE_SELECTED_SQUARE
@NotNull public static final @NotNull java.lang.String SQUARE_PRE_SELECTED_SQUARE
- See Also:
- Constant Field Values
-
SQUARE_CURSOR
@NotNull public static final @NotNull java.lang.String SQUARE_CURSOR
- See Also:
- Constant Field Values
-
SQUARE_EMPTY
@NotNull public static final @NotNull java.lang.String SQUARE_EMPTY
- See Also:
- Constant Field Values
-
SQUARE_UNKNOWN
@NotNull public static final @NotNull java.lang.String SQUARE_UNKNOWN
- See Also:
- Constant Field Values
-
SQUARE_WARNING
public static final java.lang.String SQUARE_WARNING
- See Also:
- Constant Field Values
-
SQUARE_NO_FACE
@NotNull public static final @NotNull java.lang.String SQUARE_NO_FACE
- See Also:
- Constant Field Values
-
SQUARE_NO_ARCH
@NotNull public static final @NotNull java.lang.String SQUARE_NO_ARCH
- See Also:
- Constant Field Values
-
TREASURE_LIST
@NotNull public static final @NotNull java.lang.String TREASURE_LIST
- See Also:
- Constant Field Values
-
TREASUREONE_LIST
@NotNull public static final @NotNull java.lang.String TREASUREONE_LIST
- See Also:
- Constant Field Values
-
TREASURE_YES
@NotNull public static final @NotNull java.lang.String TREASURE_YES
- See Also:
- Constant Field Values
-
TREASURE_NO
@NotNull public static final @NotNull java.lang.String TREASURE_NO
- See Also:
- Constant Field Values
-
DEFAULT_ICON
@NotNull public static final @NotNull java.lang.String DEFAULT_ICON
The default map icon to use if no icon can be created.- See Also:
- Constant Field Values
-
DEFAULT_PREVIEW
@NotNull public static final @NotNull java.lang.String DEFAULT_PREVIEW
The default map preview to use if no icon can be created.- See Also:
- Constant Field Values
-
CLOSE_TAB_SMALL_ICON
@NotNull public static final @NotNull java.lang.String CLOSE_TAB_SMALL_ICON
- See Also:
- Constant Field Values
-
AUTO_RUN_SMALL_ICON
@NotNull public static final @NotNull java.lang.String AUTO_RUN_SMALL_ICON
- See Also:
- Constant Field Values
-
FILTER_SMALL_ICON
@NotNull public static final @NotNull java.lang.String FILTER_SMALL_ICON
- See Also:
- Constant Field Values
-
RUN_PLUGIN_SMALL_ICON
@NotNull public static final @NotNull java.lang.String RUN_PLUGIN_SMALL_ICON
- See Also:
- Constant Field Values
-
APP_ICON
@NotNull public static final @NotNull java.lang.String APP_ICON
Application icon definitions (icon-dir).- See Also:
- Constant Field Values
-
-
Method Detail
-
getResourceIcon
@NotNull public @NotNull javax.swing.ImageIcon getResourceIcon(@NotNull @NotNull java.lang.String iconName) throws java.util.MissingResourceExceptionReturns the image icon for the given icon name. Loads every icon only once and uses hash table to return the same instance if same icon name is given. Note: There must not be conflicting icon names from different directories.- Parameters:
iconName- the icon name- Returns:
- the image icon for the given icon name
- Throws:
java.util.MissingResourceException- if the icon cannot be loaded
-
addToCache
public void addToCache(@NotNull @NotNull java.lang.String name, @NotNull @NotNull javax.swing.ImageIcon imageIcon)Add an image to the cache.- Parameters:
name- the nameimageIcon- the image icon
-
getWarningSquareIcon
@NotNull public @NotNull javax.swing.ImageIcon getWarningSquareIcon()
-
getLightSquareIcon
@NotNull public @NotNull javax.swing.ImageIcon getLightSquareIcon()
Returns theImageIconfor highlighting map squares that are affected by nearby light emitting game objects.- Returns:
- the image icon
-
-