JTextField color

how do I change it?

name of my JTextField is kiloText

kiloText.setBackground(White) // does not work

kiloText.setBackground("White") // does not work

kiloText.setBackground(250,250,250) // does not work

are the API's always difficult to understand? or will I get better at understadning them?

thank you.

[347 byte] By [hugocppa] at [2007-10-2 7:18:56]
# 1
you have to use java.awt.Color objectsEx:-kiloText.setBackground(new Color(250,250,250)) // does not work
LRMKa at 2007-7-16 20:54:28 > top of Java-index,Java Essentials,Java Programming...
# 2
The API for the method setBackgroud for JTextField is as follows - public void setBackground(Color bg) :).So you will have to supply a Color object. Something like - import java.awt.Color;kiloText.setBackground(Color.White);
Muyeena at 2007-7-16 20:54:28 > top of Java-index,Java Essentials,Java Programming...
# 3
may i know, why in the APIstatic Color blue The color blue.static Color BLUE The color blue.what is the difference between BLUE and blue
variablea at 2007-7-16 20:54:28 > top of Java-index,Java Essentials,Java Programming...
# 4

> may i know, why in the API

>

>

> static Color blue

>The color blue.

> static Color BLUE

>The color blue.

>

> what is the difference between BLUE and blue

>

The original blue didn't comply with the naming conventions for constants, and then BLUE was added. They couldn't remove blue for backwards-compatibility reasons.

CeciNEstPasUnProgrammeura at 2007-7-16 20:54:28 > top of Java-index,Java Essentials,Java Programming...
# 5

> The original blue didn't comply with the naming

> conventions for constants, and then BLUE was added.

> They couldn't remove blue for backwards-compatibility

> reasons.

i was looking at 1.4.2 doc . i am surprised to see the same thing even at 1.5.0 !

however, i shall be stick to "BLUE".

thank you

variablea at 2007-7-16 20:54:28 > top of Java-index,Java Essentials,Java Programming...
# 6
> i was looking at 1.4.2 doc . i am surprised to see> the same thing even at 1.5.0 !It will stay, since you can't remove it because old code wouldn't compile or run anymore on newer JVMs. But don't ask me why it's not deprecated.
CeciNEstPasUnProgrammeura at 2007-7-16 20:54:28 > top of Java-index,Java Essentials,Java Programming...