Package net.sf.freecol.common.resources
Class ColorResource
- java.lang.Object
-
- net.sf.freecol.common.resources.Resource
-
- net.sf.freecol.common.resources.ColorResource
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.freecol.common.resources.Resource
Resource.Cleanable
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Colorcolorprivate static java.util.logging.Loggerloggerstatic java.awt.ColorREPLACEMENT_COLORstatic java.lang.StringSCHEME
-
Constructor Summary
Constructors Constructor Description ColorResource(java.lang.String primaryKey, java.awt.Color color)ColorResource(java.lang.String primaryKey, java.net.URI resourceLocator)Do not use directly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.awt.ColorcreateColor(java.lang.String colorName)Returns theColoridentified by the given string.java.awt.ColorgetColor()Gets theColorrepresented by this resource.private static booleanisHexString(java.lang.String str)voidpreload()Preload the resource if possible/meaningful.-
Methods inherited from class net.sf.freecol.common.resources.Resource
getPrimaryKey, getResourceLocator
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
REPLACEMENT_COLOR
public static final java.awt.Color REPLACEMENT_COLOR
-
SCHEME
public static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
color
private final java.awt.Color color
-
-
Constructor Detail
-
ColorResource
public ColorResource(java.lang.String primaryKey, java.awt.Color color)
-
ColorResource
public ColorResource(java.lang.String primaryKey, java.net.URI resourceLocator)Do not use directly.- Parameters:
primaryKey- The primary key.resourceLocator- TheURIused when loading this resource.
-
-
Method Detail
-
preload
public void preload()
Preload the resource if possible/meaningful.
-
getColor
public java.awt.Color getColor()
Gets theColorrepresented by this resource.- Returns:
- The
Colorin it's original size.
-
isHexString
private static boolean isHexString(java.lang.String str)
-
createColor
private static java.awt.Color createColor(java.lang.String colorName)
Returns theColoridentified by the given string. This is either a hexadecimal integer prefixed with "0x", or the name of a field of the Color class.- Parameters:
colorName- aStringvalue- Returns:
- a
Colorvalue
-
-