Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing color of text on a disabled JButton

843806Feb 16 2009 — edited Feb 16 2009
Hello,

I have a board represented by rows and columns of buttons. Once the button is clicked, I want to disable it (using setEnabled(false)). Then I want to put display text on it and I call setText() but I also want to change the text color,
so I call setForeground(). Unfortunately, setForeground() doesn't seem to work once the button has been disabled. I do not really want to use Icons for just some text. Is there any way to overcome this problem please? setBackground still works while the button is disabled.

Thank you very much.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2009
Added on Feb 16 2009
16 comments
7,985 views