javaxmlswingsynth

Custom look and feel JPogressBar & JSplitPane xml using synth


I am trying to make a custom look and feel for my program using an xml file using synth, and it is working well, but I'm not sure how customize the JProgressBar or the JSplitPane. I got a border on the JProgressBar with no issues, but I can't find how to customize the loading animation. The loading bar is set to indeterminate by the way. And as far as the SplitPane the only thing I struggle to get working is the split pane drag divider. The split pane works fine in the program, just when you drag it the division line doesn't show up. Here is my current xml file. Thanks for the help.

<?xml version="1.0" encoding="utf-8"?>
<synth>
<style id="frameStyle">
    <style id="backingStyle">
        <opaque value="TRUE" />
        <font name="Monaco" size="18" />
        <state>
            <color value="BLACK" type="BACKGROUND" />
            <color value="GRAY" type="FOREGROUND" />
        </state>
    </style>
    <bind style="backingStyle" type="region" key=".*" />
</style>


<style id="intputFieldStyle">
    <insets top="0" left="4" bottom="4" right="4" />
    <state>
        <font name="Verdana" size="14" />
        <color value="BLACK" type="BACKGROUND" />
        <color value="WHITE" type="FOREGROUND" />
    </state>
    <imagePainter method="textFieldBorder" path="laf/txtfld.png"
        sourceInsets="4 4 4 4" paintCenter="false" />
</style>


<style id="buttonStyle">
    <state>
        <font name="Monaco" size="12" />
        <color value="LIGHT_GRAY" type="FOREGROUND" />
        <imagePainter method="buttonBackground" path="laf/button_up.png"
            sourceInsets="4 3 3 4" paintCenter="false" />
    </state>
    <state value="PRESSED">
        <imagePainter method="buttonBackground" path="laf/button_down.png"
            sourceInsets="4 3 3 4" paintCenter="false" />
    </state>

    <state value="MOUSE_OVER">
        <imagePainter method="buttonBackground" path="laf/button_mouseover.png"
            sourceInsets="4 3 3 4" paintCenter="false" />
    </state>
</style>


<style id="userListStyle">
    <state>
        <font name="Monaco" size="12" />
        <color value="LIGHT_GRAY" type="BACKGROUND" />
        <color value="BLACK" type="FOREGROUND" />
    </state>
    <state value="SELECTED">
        <font name="Monaco" size="12" />
        <color value="MAGENTA" type="TEXT_BACKGROUND" />
        <color value="BLACK" type="TEXT_FOREGROUND" />
    </state>
</style>


<style id="labelStyle">
    <state>
        <color value="LIGHT_GRAY" type="FOREGROUND" />
    </state>
</style>


<style id="loadingBarStyle">
    <state>
        <color value="BLUE" type="BACKGROUND" />
        <color value="GREEN" type="FOREGROUND" />
        <imagePainter method="progressBarBorder" path="laf/loadingbar_outside.png"
            sourceInsets="6 6 6 6" paintCenter="false" />
    </state>
</style>


<style id="panelStyle">
    <state>
        <color value="DARK_GRAY" type="BACKGROUND" />
    </state>
</style>

<style id="splitPaneStyle">
    <state>
        <color value="WHITE" type="FOREGROUND"/>
    </state>
</style>

<bind style="frameStyle" type="region" key="Frame" />               <!-- Bind Frame -->
<bind style="intputFieldStyle" type="region" key="TextField" />     <!-- Bind textBox -->
<bind style="labelStyle" type="region" key="Label" />               <!-- Bind label -->
<bind style="loadingBarStyle" type="region" key="ProgressBar" />    <!-- Bind loadingbar -->
<bind style="buttonStyle" type="region" key="Button" />             <!-- Bind Login buttons -->
<bind style="userListStyle" type="region" key="List" />             <!-- Bind user list -->
<bind style="panelStyle" type="region" key="Panel" />               <!-- Bind Panel -->
<bind style="splitPaneStyle" type="region" key="SplitPane" />       <!-- Bind Split Pane -->


Solution

  • After many hours searching through Synth source code, I solved the issue. The split has a key of SplitPaneDivider and the progress bad has a key of ProgressBar simply. The respective methods are splitPaneDragDivider and progressBarForeground/Background.