File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes TextField background color inconsistencies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TextField background color inconsistencies" Watch "TextField background color inconsistencies" New topic

TextField background color inconsistencies

Karen Parker

Joined: May 16, 2001
Posts: 15
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.
I agree. Here's the link:
subject: TextField background color inconsistencies
It's not a secret anymore!