iRex DR1000 Manager v0.6

it.andynaz.irex.dr1000.util
Class ColorMgr

java.lang.Object
  extended by it.andynaz.irex.dr1000.util.ColorMgr

public class ColorMgr
extends Object

Manage the color used for the stroke. The color can be retrived with the getColor() method.

This class can safely manage the color used in the strokes: it contains an inner color to be used in the strokes and an method to safely initialize the color. When the class is first loaded, the inner color is set using the parameter "color" from the ConfigMgr class from andyLib. In this way a color is always available.

In all the methods, color codes can be specified both as a RRGGBB or a #RRGGBB string.

Version:
2013/11/06
Author:
andynaz

Field Summary
private static Color _color
          Color of the strokes.
 
Constructor Summary
private ColorMgr()
           
 
Method Summary
static Color getColor()
          Returns the color in the class.
private static String normalizeColorCode(String s)
          Normalize the color code.
static void setColor(String colorCode)
          Safely set the color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_color

private static Color _color
Color of the strokes. Whe the class is first loaded, it is inizialized with che color in the "color" config param.

Constructor Detail

ColorMgr

private ColorMgr()
Method Detail

setColor

public static void setColor(String colorCode)
Safely set the color. If the colorCode does not correspond to a valid color code, this method does nothing.

Parameters:
colorCode - numeric code of the color

getColor

public static Color getColor()
Returns the color in the class.

Returns:
the color to be used in the strokes

normalizeColorCode

private static String normalizeColorCode(String s)
Normalize the color code. A '#' character is added at the beginning of the string s if it does not begin with '#'.

Parameters:
s - a string color code
Returns:
the same string suitable to be used with the method Color.decode(String)

iRex DR1000 Manager v0.6

© 2013 andynaz - http://andynaz.altervista.org