javaxmlswingbuttonsynth

Java Synth XML: Button Style properties won't work


I'm new to XML - and new to Java Synth LAF...

I have loaded the following XML style file correctly to my UIManager:

<synth>
<style id="default">
    <font name="Segoe UI" size="16"/>
</style>
<bind style="default" type="region" key=".*"/>

<style id="button">
    <opaque value="true">
        <insets top="10" bottom="10" left="10" right="10"/>
        <state>
            <color type="BACKGROUND" value="#FFFFFF"/>
            <color type="TEXT_FOREGROUND" value="#000000"/>
        </state>
    </opaque>
</style>
<bind style="button" type="region" key="Button"/>

The default style works fine but the button style doesn't work for some reason.

Thanks in advance


Solution

  • The opaque element - Synth File Format

    The opaque element is empty elements because it is declared with the category keyword EMPTY.

    <!ELEMENT opaque EMPTY>
    <!ATTLIST opaque
              value              (true|false)   "true"
    >
    
    <synth>
      <style id="default">
        <font name="Segoe UI" size="16"/>
      </style>
      <bind style="default" type="region" key=".*"/>
    
      <style id="button">
        <opaque value="true"/>
        <insets top="10" bottom="10" left="10" right="10"/>
        <state>
          <color type="BACKGROUND" value="#FFFFFF"/>
          <color type="TEXT_FOREGROUND" value="#000000"/>
        </state>
      </style>
      <bind style="button" type="region" key="Button"/>
    </synth>