Java examples for 2D Graphics:Color
Converts a color into a String like 255,0,0.
/**/* w w w . ja v a2 s . co m*/ * Copyright 1998-2008, CHISEL Group, University of Victoria, Victoria, BC, Canada. * All rights reserved. */ //package com.java2s; import java.awt.Color; public class Main { /** * Converts a color into a String like 255,0,0. * @param color Color to convert into a String. * @return String color RGB String. */ public static String colorToRGBString(Color color) { String rgb = ""; if (color != null) { rgb = color.getRed() + "," + color.getGreen() + "," + color.getBlue(); } return rgb; } }