Java Nimbus Button.foreground not working

2019-06-24 02:21发布

问题:

I am using the Nimbus LAF on my application and I want to change all buttons foreground colors. I do this setting:

UIManager.put("Button.foreground", Color.WHITE);

But this is not working. Maybe it is because I should only use the primary and secondary Nimbus colors? Could anyone help me please?

Thanks a lot.

回答1:

simple way

1) you can set Color once by put value to UIManager, then will be valid for whole (for example JLabel) instance

2) dynamically set and override UIManager repeatedly

most complex way

3) create own UIManager, for example by aephyr

EDIT:

< to avoiding to create own Painters /> maybe correct way could be use non_buggy and todays Custom Look and Feel