Here you can find the source of webColorCodeToJava(String value)
public static Color webColorCodeToJava(String value)
//package com.java2s; import java.awt.Color; public class Main { public static Color webColorCodeToJava(String value) { if (value.startsWith("#")) { value = value.substring(1);//from ww w . j ava 2s . co m int red = Integer.parseInt(value.substring(0, 2), 16); int green = Integer.parseInt(value.substring(2, 4), 16); int blue = Integer.parseInt(value.substring(4, 6), 16); return new Color(red, green, blue); } return Color.WHITE; } }