public class ColorMgr
extends java.lang.Object
getBgColor()
and getColor(int)
methods.
When the class is first loaded, the background color is set to white
and all the stroke colors to black
.
Then, they are set using the "colorBackground", "color" and "colorX"
parameters (X from 1 to 5) from the ConfigMgr
class from
andyLib. In this way a color is always available and the default one
can be set using the configuration.
Note: color codes can be specified as a [#][AA]RRGGBB
string; if
the string is not well-formed or color is null, all the set methods will not
do anything.
Modifier and Type | Field and Description |
---|---|
private static java.awt.Color |
_colorBg
Color of the background.
|
private static java.awt.Color[] |
_colorStrokes
Color of the strokes.
|
Modifier | Constructor and Description |
---|---|
private |
ColorMgr() |
Modifier and Type | Method and Description |
---|---|
private static java.awt.Color |
decodeColor(java.lang.String s)
Return a color.
|
static java.awt.Color |
getBgColor()
Returns the color for the background.
|
static java.awt.Color |
getColor(int strokeWidth)
Returns the color for a stroke.
|
static void |
setBgColor(java.awt.Color color)
Sets the colors for the background.
|
static void |
setBgColor(java.lang.String colorCode)
Sets the colors for the background.
|
static void |
setColor(java.awt.Color color)
Sets all the colors.
|
static void |
setColor(int strokeWidth,
java.awt.Color color)
Sets the color for a stroke.
|
static void |
setColor(int strokeWidth,
java.lang.String colorCode)
Safely sets the color for a stroke.
|
static void |
setColor(java.lang.String colorCode)
Safely sets all the colors.
|
private static java.awt.Color _colorBg
private static final java.awt.Color[] _colorStrokes
public static void setBgColor(java.lang.String colorCode)
colorCode
does not correspond to a valid color code, this
method does nothing.colorCode
- numeric code of the colorpublic static void setBgColor(java.awt.Color color)
color==null
, this method does nothing.color
- the colorpublic static void setColor(java.lang.String colorCode)
colorCode
does not correspond to a valid color code, this
method does nothing.colorCode
- numeric code of the colorpublic static void setColor(java.awt.Color color)
color==null
, this method does nothing.color
- numeric code of the colorpublic static void setColor(int strokeWidth, java.lang.String colorCode)
colorCode
does not correspond to a valid color code, this
method does nothing.strokeWidth
- width of the stroke to setcolorCode
- numeric code of the colorjava.lang.ArrayIndexOutOfBoundsException
- if strokeWidth
is not from
1 to 5public static void setColor(int strokeWidth, java.awt.Color color)
color==null
, this method does nothing.strokeWidth
- width of the stroke to setcolor
- numeric code of the colorjava.lang.ArrayIndexOutOfBoundsException
- if strokeWidth
is not from
1 to 5public static java.awt.Color getBgColor()
public static java.awt.Color getColor(int strokeWidth)
strokeWidth
- width of the stroke to retriveprivate static java.awt.Color decodeColor(java.lang.String s)
s
as '[#][AA]RRGGBB'
value.s
- the value of the colornull
is string cannot be converted to a
color© 2015 andynaz - http://andynaz.altervista.org