Many applications don't need high quality color reproduction. Standard user interface components like buttons and scrolling lists don't demand accurate color reproduction — it doesn't matter if buttons are a slightly different color on different machines. Likewise, for charts and figures, it may not matter if the colors vary from machine to machine. But if you're writing desktop publishing software, or image manipulation software, you will need to be more careful. I'll talk about 2D's support for correct color handling later in this chapter.
If your application doesn't demand that colors look exactly the same everywhere, you don't have to read most of this chapter. It's easy to work with color without worrying about color spaces or profiles.
The java.awt.Color class represents a color in a default RGB color space. To create a color, just specify its red, green, and blue components:
public Color(int r, int g, int b)
This constructor creates a new Color using the specified values for red, green and blue. The values should range from to 255, inclusive.
public Color(float r, float g, float b)
This constructor creates a new Color using the specified values for red, green and blue. The values should range from 0.0 to 1.0, inclusive.
public Color(int rgb)
This constructor accepts the red, green, and blue values in a packed integer. This means that the red, green, and blue values, which are 8 bits each, are stored inside a Java ...