This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
We're working on a Java 1.1.8 applet where we want to draw some stuff on a canvas, and have a number of corresponding TextFields with the same background color as the images on the canvas. For example, we want to draw a yellow arrow and have a textfield in our applet that is the same color of yellow as the arrow. We create a color using RGB values and the new Color(int, int, int) constructor. We set the background of the TextField to this color, and also set the current Graphics object color to the same thing when we are drawing on the canvas. The problem is, the "yellow" TextField ends up looking a fair bit lighter than the "yellow" shapes on our canvas. The only time this doesn't happen is if we use one of the predefined java Colors (e.g. Color.yellow) instead of using RGB values to create our own.