Synth provides a way to use xml to customize java swing look and feel. From my understanding, it could do general customization. For example:
General JButton: set its font, background, foreground ... to all buttons (synth could do this)
but i also have a specified MyButton on my specified GUI (suppose in com.jasons.MyPanel), i want it has a different font, background from general Jbutton.
So does synth xml support this (and how)? thanks!
Synth L&F supports also name-binding.
Here is the XML example:
<style id="defaultHeaderPanel">
<insets top="4" left="4" bottom="4" right="4"/>
<state>
<opaque value="true" />
<color type="BACKGROUND" value="#00538c"/>
</state>
</style>
<bind style="defaultHeaderPanel" type="name" key="DefaultHeaderPanel" />
To use this style you need to call the method setName(String)
with the key
of your bind
XML element.
For example:
public class HeaderPanel extends JPanel {
public HeaderPanel() {
setName("DefaultHeaderPanel"); // assign style name
}
}