Here you can find the source of convertStringToColor(String color)
static Color convertStringToColor(String color)
//package com.java2s; public class Main { static Color convertStringToColor(String color) { Color colorConverted = Color.black; //Default// if (color.equals("black")) { colorConverted = Color.black; }//from w w w. j ava 2s .c o m if (color.equals("red")) { colorConverted = Color.red; } if (color.equals("blue")) { colorConverted = Color.blue; } if (color.equals("green")) { colorConverted = Color.green; } if (color.equals("orange")) { colorConverted = Color.orange; } return colorConverted; } }