|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bbn.openmap.util.ColorFactory
ColorFactory creates instances of colors. This class has methods
which create java.awt.Color
or
com.bbn.openmap.omGraphics.OMColor
objects. This
class handles creation of Color objects in a Java version-neutral
way by using reflection to create the java.awt.Color object. This
way we support the extended Java 2 platform without sacrificing
support for JDK 1.1.X.
NOTE: For general RGB-colored graphics, you should directly use the java.awt.Color 1.1.X constructors. If you are interested in using alpha-valued colors, or using colors in a (JDK) version-neutral way, then read on...
You may want to use this class because:
createColor()
methods in this class with the forceAlpha
set to
true
and you are guaranteed (almost!) to get back an
alpha-valued color.
createColor()
methods
without the forceAlpha
argument, or with
forceAlpha
set to false.
OMColor
Constructor Summary | |
ColorFactory()
|
Method Summary | |
static java.awt.Color |
createColor(float red,
float green,
float blue,
float alpha)
Create a Color. |
static java.awt.Color |
createColor(float red,
float green,
float blue,
float alpha,
boolean forceAlpha)
Create a Color. |
static java.awt.Color |
createColor(int value)
Create a Color. |
static java.awt.Color |
createColor(int value,
boolean forceAlpha)
Create a Color. |
static java.awt.Color |
createColor(int red,
int green,
int blue,
int alpha)
Create a Color. |
static java.awt.Color |
createColor(int red,
int green,
int blue,
int alpha,
boolean forceAlpha)
Create a Color. |
static java.lang.String |
getHexColorString(java.awt.Color color)
|
static java.awt.Color |
parseColor(java.lang.String colorString)
Convert a string representing a 24/32bit hex color value into a Color value. |
static java.awt.Color |
parseColor(java.lang.String colorString,
boolean forceAlpha)
Convert a string representing a 24/32bit hex color value into a Color value. |
static java.awt.Paint |
parseColorFromProperties(java.util.Properties p,
java.lang.String propName,
java.awt.Paint dfault)
Take a string from a properties file, representing the 24bit RGB or 32bit ARGB hex values for a color, and convert it to a java.awt.Color. |
static java.awt.Color |
parseColorFromProperties(java.util.Properties p,
java.lang.String propName,
java.lang.String dfault)
Take a string from a properties file, representing the 24bit RGB or 32bit ARGB hex values for a color, and convert it to a java.awt.Color. |
static java.awt.Color |
parseColorFromProperties(java.util.Properties p,
java.lang.String propName,
java.lang.String dfault,
boolean forceAlpha)
Take a string from a properties file, representing the 24bit RGB or 32bit ARGB hex values for a color, and convert it to a java.awt.Color. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ColorFactory()
Method Detail |
public static java.awt.Color parseColorFromProperties(java.util.Properties p, java.lang.String propName, java.lang.String dfault) throws java.lang.NumberFormatException
p
- propertiespropName
- the name of the propertydfault
- color to use if the property value doesn't work
java.lang.NumberFormatException
- if the specified string cannot
be interpreted as a hexidecimal integerparseColor(String, boolean)
public static java.awt.Color parseColorFromProperties(java.util.Properties p, java.lang.String propName, java.lang.String dfault, boolean forceAlpha) throws java.lang.NumberFormatException
p
- propertiespropName
- the name of the propertydfault
- color to use if the property value doesn't workforceAlpha
- force using alpha value
java.lang.NumberFormatException
- if the specified string cannot
be interpreted as a hexidecimal integerparseColor(String, boolean)
public static java.awt.Paint parseColorFromProperties(java.util.Properties p, java.lang.String propName, java.awt.Paint dfault)
p
- propertiespropName
- the name of the propertydfault
- color to use if the property value doesn't work
parseColor(String, boolean)
public static java.awt.Color parseColor(java.lang.String colorString) throws java.lang.NumberFormatException
colorString
- the 24/32bit hex string value (ARGB)
java.lang.NumberFormatException
- if the specified string cannot
be interpreted as a hexidecimal integerparseColor(String, boolean)
public static java.awt.Color parseColor(java.lang.String colorString, boolean forceAlpha) throws java.lang.NumberFormatException
colorString
- the 24/32bit hex string value (ARGB)forceAlpha
- force using alpha value
java.lang.NumberFormatException
- if the specified string cannot
be interpreted as a hexidecimal integercreateColor(int, boolean)
public static java.awt.Color createColor(float red, float green, float blue, float alpha)
red
- red component (0.0-1.0)green
- green component (0.0-1.0)blue
- blue component (0.0-1.0)alpha
- alpha component (0.0-1.0)
createColor(int, boolean)
public static java.awt.Color createColor(float red, float green, float blue, float alpha, boolean forceAlpha)
red
- red component (0.0-1.0)green
- green component (0.0-1.0)blue
- blue component (0.0-1.0)alpha
- alpha component (0.0-1.0)forceAlpha
- force using alpha value
createColor(int, boolean)
public static java.awt.Color createColor(int red, int green, int blue, int alpha)
red
- red component (0-255)green
- green component (0-255)blue
- blue component (0-255)alpha
- alpha component (0-255)
createColor(int, boolean)
public static java.awt.Color createColor(int red, int green, int blue, int alpha, boolean forceAlpha)
red
- red component (0-255)green
- green component (0-255)blue
- blue component (0-255)alpha
- alpha component (0-255)forceAlpha
- force using alpha value
createColor(int, boolean)
public static java.awt.Color createColor(int value)
value
- 32bit ARGB color value
createColor(int, boolean)
public static java.awt.Color createColor(int value, boolean forceAlpha)
value
- 32bit ARGB color valueforceAlpha
- force using alpha value the underlying
java.awt.Color supports it
public static java.lang.String getHexColorString(java.awt.Color color)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |