protected Color GetColorFromString(String token){
  String tokstring=(String)token;
  Color result=Color.black;
  if (Debug.debugging("areas")) {
    Debug.output("AreaHandler: GetColorFromString(" + tokstring + ")");
  }
  if (tokstring.equals("black"))   result=Color.black;
 else   if (tokstring.equals("blue"))   result=Color.blue;
 else   if (tokstring.equals("cyan"))   result=Color.cyan;
 else   if (tokstring.equals("darkGray"))   result=Color.darkGray;
 else   if (tokstring.equals("gray"))   result=Color.gray;
 else   if (tokstring.equals("green"))   result=Color.green;
 else   if (tokstring.equals("lightGray"))   result=Color.lightGray;
 else   if (tokstring.equals("magenta"))   result=Color.magenta;
 else   if (tokstring.equals("orange"))   result=Color.orange;
 else   if (tokstring.equals("pink"))   result=Color.pink;
 else   if (tokstring.equals("red"))   result=Color.red;
 else   if (tokstring.equals("white"))   result=Color.white;
 else   if (tokstring.equals("yellow"))   result=Color.yellow;
 else   result=Color.decode(tokstring);
  if (Debug.debugging("areas")) {
    Debug.output("AreaHandler.GetColorFromToken returns (" + result + ")");
  }
  return result;
}

protected Color GetColorFromString ( String token ) { String tokstring = ( String ) token ; Color result = Color . black ; if ( Debug . debugging ( "areas" ) ) { Debug . output ( "AreaHandler: GetColorFromString(" + tokstring + ")" ) ; } if ( tokstring . equals ( "black" ) ) result = Color . black ; else if ( tokstring . equals ( "blue" ) ) result = Color . blue ; else if ( tokstring . equals ( "cyan" ) ) result = Color . cyan ; else if ( tokstring . equals ( "darkGray" ) ) result = Color . darkGray ; else if ( tokstring . equals ( "gray" ) ) result = Color . gray ; else if ( tokstring . equals ( "green" ) ) result = Color . green ; else if ( tokstring . equals ( "lightGray" ) ) result = Color . lightGray ; else if ( tokstring . equals ( "magenta" ) ) result = Color . magenta ; else if ( tokstring . equals ( "orange" ) ) result = Color . orange ; else if ( tokstring . equals ( "pink" ) ) result = Color . pink ; else if ( tokstring . equals ( "red" ) ) result = Color . red ; else if ( tokstring . equals ( "white" ) ) result = Color . white ; else if ( tokstring . equals ( "yellow" ) ) result = Color . yellow ; else result = Color . decode ( tokstring ) ; if ( Debug . debugging ( "areas" ) ) { Debug . output ( "AreaHandler.GetColorFromToken returns (" + result + ")" ) ; } return result ; }
this function would return a color object for string such as red , green , . . ( all that are available from java . awt . color class ) . it can also return a specific color represented by hex or octal number like 0xffeeffee
