/* * ColorItem.java - This is our object we're storing in the dictionary. * * Copyright (c) 1996 Chuck McManis, All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. * * CHUCK MCMANIS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. CHUCK MCMANIS * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT * OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.awt.Color; /** * This class implements a "color item" which is nothing more * than a 'named' color. */ public class ColorItem { private String name; private Color value; float vals[]; public ColorItem(String n, Color v) { name = n; value = v; } public Color toColor() { return value; } public String nameOf() { return name; } float val[] = new float[3]; public String toString() { Color.RGBtoHSB(value.getRed(), value.getGreen(), value.getBlue(), val); return "Color: "+name+", value "+val[0]; } }