简体   繁体   English

使用合成器自定义外观JPogressBar和JSplitPane xml

[英]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. 我正在尝试使用使用synth的xml文件为我的程序创建自定义外观,并且效果很好,但是我不确定如何自定义JProgressBar或JSplitPane。 I got a border on the JProgressBar with no issues, but I can't find how to customize the loading animation. 我在JProgressBar上没有任何问题,但是找不到如何自定义加载动画的边框。 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. 就SplitPane而言,我要努力工作的唯一一件事就是拆分窗格的拖动分隔器。 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. 这是我当前的xml文件。 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 -->

After many hours searching through Synth source code, I solved the issue. 在搜索Synth源代码很多小时后,我解决了该问题。 The split has a key of SplitPaneDivider and the progress bad has a key of ProgressBar simply. 拆分有一个SplitPaneDivider键,进度不好有一个ProgressBar键。 The respective methods are splitPaneDragDivider and progressBarForeground/Background . 各自的方法是splitPaneDragDividerprogressBarForeground/Background

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM