Tutorial: Swing Synth PLAF Template - Part 11: Targeting Styles
Is CSS, you can target elements and style them specially, e.g. as a title, or important button. You can do the same in Swing by setting their name:
new JButton("Button named 'primary'") {{setName("primary");}}
In the XML you can set-up colours for this name and they’ll be applied.
<object class="javax.swing.plaf.ColorUIResource" id="primaryfg"><int>255</int><int>0</int><int>0</int></object>
<object class="javax.swing.plaf.ColorUIResource" id="primarybg"><int>50</int><int>50</int><int>50</int></object>
<style id="primary">
<state><color type="FOREGROUND" idref="primaryfg"/>
<color type="BACKGROUND" idref="primarybg"/> </state>
</style>
<bind style="primary" type="name" key="primary"/>