Solved

Change JComboBox foreground color when disabled

Posted on 2006-06-15
11
1,037 Views
Last Modified: 2012-06-27
Hi

I want to ask how can I change the foreground color of JComboBox when disabled because UIManager.put doesnt work for me????
0
Comment
Question by:mattjulius
  • 4
  • 2
  • 2
  • +1
11 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 25 total points
ID: 16918009
Try

put("ComboBox.disabledForeground", Color.gray);
0
 

Author Comment

by:mattjulius
ID: 16918232
I already tried it once and it works but most of the time it doesnt. Is there any way to do it properly
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16918240
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 92

Assisted Solution

by:objects
objects earned 25 total points
ID: 16918433
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
 

Author Comment

by:mattjulius
ID: 16918677
What do you mean OBJECTS???
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16920063
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
 

Author Comment

by:mattjulius
ID: 16924590
hey mayankeagle ,

Have you try it?? because its not working for me and Im using JInternalFrame...
0
 

Author Comment

by:mattjulius
ID: 16924595
Is there any other way to change the foreground of the JComboBox when disable??
0
 
LVL 92

Expert Comment

by:objects
ID: 16925915
OIt depends on what L&F you are using, how it is displayed is L&F dependenet.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question