Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java set Font Color in a disabled Text Field

I have a disabled JTextField and due to readability problems i want to make the font black again. So that it looks like its not disabled, but i cant edit it. any suggestions?

like image 375
Simiil Avatar asked Sep 13 '10 08:09

Simiil


People also ask

How to change font color in disabled input?

Approach: With adding basic CSS property we are able to change the font-color of a disabled input. The disabled input element is unusable and un-clickable. This is a boolean attribute. Here using the color property of input we can change the font-color of this disabled input element.


2 Answers

You can use the setDisabledTextColor(Color c) method to set the desired color. For more information check: javadocs

like image 187
Faisal Feroz Avatar answered Sep 27 '22 17:09

Faisal Feroz


Try using the method setDisabledTextColor (inherited from JTextComponent)

like image 37
JohnoBoy Avatar answered Sep 27 '22 16:09

JohnoBoy