开发者

Changing the ControlShadow color of JComboBoxes only

开发者 https://www.devze.com 2023-02-03 01:15 出处:网络
I\'ve been asked 开发者_如何转开发to change the colors of a JComboBox in an application to a very particular, non-default color scheme.

I've been asked 开发者_如何转开发to change the colors of a JComboBox in an application to a very particular, non-default color scheme.

I've found that if I change the value of the

System.UserInterface.Colors.SwingDefaults.ControlShadow

of the Resource Map file from this:

            <Color ident="ControlShadow" value="#999999"/>

to this:

            <Color ident="ControlShadow" value="#FFFFFF"/>

everything looks as it should.

However, I don't want to change the ControlShadow Color for all Swing controls, so I need to find a more focused fix.

Is there a way to change this color for only JComboBoxes?

Note that I tried changing the value of ComboBox.buttonShadow (to #FFFFFF) but this didn't work.


I don't think you should be playing with the resource file.

Check out the UIManager Defaults for a potential way to do this. Look at the "System Colors" to see the default value of the "controlShadow". If you then look at the combo box you will see that the "ComboBox.buttonShadow" has the same value. Maybe you change this value for your LAF. Otherwise you need to create a custom combo box UI. Search the source code to see where this value is used and you will know what to change.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号