Results 1 to 15 of 15
- 04-24-2011, 08:39 AM #1
Senior Member
- Join Date
- Jan 2011
- Location
- Rizal Province, Philippiines
- Posts
- 167
- Rep Power
- 0
- 04-24-2011, 08:48 AM #2
- 04-24-2011, 08:58 AM #3
Senior Member
- Join Date
- Jan 2011
- Location
- Rizal Province, Philippiines
- Posts
- 167
- Rep Power
- 0
- 04-24-2011, 09:22 AM #4
Java can but that requires you to specify your own look and feel in Swing. If you really need to change this color, I suggest subclassing the appropriate Nimbus ComboBoxUI implementation and using your own painting. But I have never done this so I'm not sure which class exactly to subclass and what methods to use and override. :/
- 04-24-2011, 09:43 AM #5
Senior Member
- Join Date
- Jan 2011
- Location
- Rizal Province, Philippiines
- Posts
- 167
- Rep Power
- 0
Do you know how to override the JComboBox when it is click it doesn't anything
Last edited by RichersooN; 04-24-2011 at 09:45 AM.
-
Have you tried using the UIManager to change the default colors? Something like:
Java Code:Color newColor = new Color(250, 50, 50); // or whatever color you want UIManager.put("ComboBox.disabledBackground", newColor);
For more on this, please see this section of Rob Camick's excellent blog: uimanager-defaults
- 04-24-2011, 03:05 PM #7
- 04-24-2011, 03:15 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Did you try this method: public void enableInputMethods(boolean enable)? It's a method in the Component class (A JComboBox extends from that class).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 04-24-2011, 06:05 PM #9
- 04-24-2011, 07:07 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
- 04-24-2011, 07:10 PM #11
- 04-24-2011, 07:39 PM #12
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 04-24-2011, 10:26 PM #13
I just played around with JComboBox; it changes the background color normally enabled and disabled.
This works for me.
Java Code:box.setBackground(Color.blue); box.setEnabled(false);
- 05-04-2011, 02:00 PM #14
Member
- Join Date
- May 2011
- Location
- Munich
- Posts
- 15
- Rep Power
- 0
The combo is made up of a textfield (or label) and a button. You need to find out how to access the textfield inside the combo.
Have you tried accessing the components inside the combo box? Changing the editor or renderer?
I refuse to believe it is not possible to do without Look and Feel.
- 07-25-2012, 05:08 AM #15
Member
- Join Date
- Jul 2012
- Posts
- 1
- Rep Power
- 0
Re: how can i change color of disabled jcombox
this does not work and I'm suprised that it seems to be working for you, are you sure the background wasn't already blue?
I searched many forums for an answer to this as I had no luck with standard setForeground methods etc and changing the UImanager either as .put or getDefaults().put did not work.
the only solution I found that worked - and it's quite simple was
((JTextField) comboBox.getEditor().getEditorComponent()).setDisa bledTextColor(Color.#####);
apparently this is only supposed to work for enabled boxes but it worked for my disabled boxes perfectly and can be done befoer or after the box enabled is set to false
i can see from the time stamps that you most likely don't need or care about this anymore but thought I'd post it to make it easier for anyone else searching for a solution
Similar Threads
-
How to change the default background color of a DISABLED JButton
By ryogananda in forum Java AppletsReplies: 4Last Post: 03-21-2009, 05:48 PM -
Color Change of data
By Java.child in forum AWT / SwingReplies: 20Last Post: 02-12-2009, 06:51 AM -
Text color in disabled componentes
By saul_2110 in forum AWT / SwingReplies: 8Last Post: 12-13-2008, 05:37 AM -
Disabled JButton font color
By p900128 in forum Advanced JavaReplies: 1Last Post: 07-24-2008, 08:16 AM -
How to change the foreground color of a disabled control
By arunkumarsimhadri in forum New To JavaReplies: 0Last Post: 07-09-2008, 04:30 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks