Here you can find the source of stringToColor(String s)
public static Color stringToColor(String s)
//package com.java2s; import java.awt.Color; public class Main { public static Color stringToColor(String s) { if (s.startsWith("[")) { s = s.substring(1);/*from w ww . ja v a 2 s . com*/ } if (s.endsWith("]")) { s = s.substring(0, s.length() - 1); } // System.out.println(s); int i = 0; int red = 0; int green = 0; int blue = 0; for (String p : s.split(",")) { if (i == 0) { red = Integer.parseInt(p); } else if (i == 1) { green = Integer.parseInt(p); } else if (i == 2) { blue = Integer.parseInt(p); } i++; } return new Color(red, green, blue); } }