Oddly enough, it is rather non-trivial to change a button’s background.
The background value is actually not tied to the part I’m interested in.
How do we change the color of the area that fills everything within the border?
The text and icons placed within the JButton should of course keep their own color and still be displayed.
In the old UI, my button looked like this:
In the new UI, it now looks like this:
How could I bring back a bit more contrast in the button relative to the JPanel it is embedded within? It currently now has the same background colors, whereas before it was a bit more obvious that it was clickable.
BTW, it’s recommended to respect the global UI. Having custom colors just for your plugin may be confusing. I think this is why a theme would be more appropriate here.
Also, keep in mind that some users may use their own theme. If you force some colors, the integration with your plugin may be suboptimal.
Wonderful, putClientProperty worked like a charm! Thanks for sharing.
This should probably be pointed out in the documentation somewhere.
Btw:
What are all the different things that can be manipulated with putClientProperty ?
Is there a way to “hot-swap” such values in a sandbox to accelerate test iterations when trying to tweak UI values like that ?
A playground plugin to quickly visualize JComponent customizations would be absolutely amazing (with side-by-side views of different themes as well, for example).