1

我正在尝试使用使用合​​成器的 xml 文件为我的程序制作自定义外观,它运行良好,但我不确定如何自定义 JProgressBar 或 JSplitPane。我在 JProgressBar 上有一个没有问题的边框,但我找不到如何自定义加载动画。顺便说一下,加载栏设置为不确定。就 SplitPane 而言,我唯一努力工作的是拆分窗格拖动分隔器。拆分窗格在程序中工作正常,只是当您拖动它时,分割线不会出现。这是我当前的 xml 文件。谢谢您的帮助。

<?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 -->

4

1 回答 1

1

经过数小时搜索 Synth 源代码后,我解决了这个问题。分裂有一个关键,SplitPaneDivider进展坏有一个ProgressBar简单的关键。相应的方法是splitPaneDragDividerprogressBarForeground/Background

于 2014-05-30T19:59:43.113 回答