Change JComboBox foreground color when disabled

Hi

I want to ask how can I change the foreground color of JComboBox when disabled because UIManager.put doesnt work for me????
mattjuliusAsked:
Who is Participating?
 
CEHJCommented:
Try

put("ComboBox.disabledForeground", Color.gray);
0
 
mattjuliusAuthor Commented:
I already tried it once and it works but most of the time it doesnt. Is there any way to do it properly
0
 
CEHJCommented:
It's a once and for all operation - not sure why 'sometimes' comes into it. It's meant to be done at the entry point of your program
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
objectsCommented:
It depends on what L&F you are using. What L&F did you want it to work for?

> I already tried it once and it works but most of the time it doesnt.

Make sure you do it *right at the begining of your app, *before* you create your gui.
0
 
mattjuliusAuthor Commented:
What do you mean OBJECTS???
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Before you call setVisible () to your JFrame (or whatever top level window you have), call UIManager.put () - better to call it right at the start of the program.
0
 
mattjuliusAuthor Commented:
hey mayankeagle ,

Have you try it?? because its not working for me and Im using JInternalFrame...
0
 
mattjuliusAuthor Commented:
Is there any other way to change the foreground of the JComboBox when disable??
0
 
objectsCommented:
OIt depends on what L&F you are using, how it is displayed is L&F dependenet.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.