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!

JComboBox.setBackground not working?

843806Aug 8 2007 — edited Aug 10 2007
I'm trying to change the background color of a JComboBox (not the selection list), and it doesn't seem to be working. For example
JComboBox myCombo = new JComboBox(new String[] { "values" });
myCombo.setBackground(Color.GREEN);
should change the background color of the JComboBox to green... right? But this doesn't seem to occur. What is interesting is that the following code
JComboBox.myCombo = new JComboBox(new String[] { "values" });
myCombo.setForeground(Color.GREEN);
will successfully change the font of the JComboBox to green.
Has anyone else experienced this problem?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2007
Added on Aug 8 2007
12 comments
2,146 views