Where can I read which colors Java is supports for Applets? Thanks
Joined: Sep 29, 2000
Java supports a full range of Colors. If you check your API there is a class for Color.
public class Color extends Object implements Paint, Serializable The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace. Every color has an implicit alpha value of 1.0 or an explicit one provided in the constructor. The alpha value defines the transparency of a color and can be represented by a float value in the range 0.0 - 1.0 or 0 - 255. An alpha value of 1.0 or 255 means that the color is completely opaque and an alpha value of 0 or 0.0 means that the color is completely transparent. When constructing a Color with an explicit alpha or getting the color/alpha components of a Color, the color components are never premultiplied by the alpha component. The default color space for the Java 2D(tm) API is sRGB, a proposed standard RGB color space. For further information on sRGB, see http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .
How were you thinking of using the color? For instance with a TextComponent you can set the Foreground or Background using TextField tf = new TextField("This will be fun"); tf.setBackground(new Color(22,156,87));//can use 3 ints or 3 floats for the red,green and blue components or you can say tf.setForeground(Color.green);// uses a static field that defines the levels to make green
"JavaRanch, where the deer and the Certified play" - David O'Meara