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.Color
color
private static java.util.logging.Logger
logger
static java.awt.Color
REPLACEMENT_COLOR
static java.lang.String
SCHEME
-
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.Color
createColor(java.lang.String colorName)
Returns theColor
identified by the given string.java.awt.Color
getColor()
Gets theColor
represented by this resource.private static boolean
isHexString(java.lang.String str)
void
preload()
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
- TheURI
used when loading this resource.
-
-
Method Detail
-
preload
public void preload()
Preload the resource if possible/meaningful.
-
getColor
public java.awt.Color getColor()
Gets theColor
represented by this resource.- Returns:
- The
Color
in 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 theColor
identified 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
- aString
value- Returns:
- a
Color
value
-
-