iRex DR1000 Manager v0.5.2

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 contains a default color to be used in the strokes and an method to safely initialize the color. When the class is first loaded, the default 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/09/22
Author:
andynaz

Field Summary
private static Color color
          Default color to use in 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
Default color to use in strokes.

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

normalizeColorCode

private static String normalizeColorCode(String s)
Normalize the color code. A '#' character is added at the beginning of the string s if it do 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.5.2

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