I am trying to change the color of a JToggleButton when it has been selected in a reliable, look and feel independent way.
If using the Metal L&F, t
You might see if setIcon() is sufficient for your purpose, but you can also override paint() in the ButtonUI delegate.
Addendum: @kleopatra's comment is well-taken: changing the UI delegate is not trivial. @mKorbel's recent example shows both the difficulty and versatility of the approach. Its essential advantage is look & feel independence.
Some less ambitious approaches are mentioned here.