简体   繁体   中英

Synth look and feel user XML how to change JTable and JTree?

I want to change JTable and JTree style through Synth LookAndFeel xml configuration. But I only found that a small part can be implemented through the xml file configuration(eg. high-line, cell-color...). For example, the cell border, the dividing line between the headers, the background color of the table selected cell, etc. have not found a configurable entry.

the code as followed:

enter code here

<style id="tableStyle">
    <state>
        <color type="BACKGROUND" value="WHITE"/>
        <color type="FOREGROUND" value="BLACK"/>
        <color value="LIGHT_GRAY" type="TEXT_BACKGROUND"/>
        <color value="BLACK" type="TEXT_FOREGROUND"/>
        <imagePainter method="tableBorder" path="images/textfield.png"
                      sourceInsets="1 1 1 0" paintCenter="false"/>
    </state>
    <object class="javax.swing.plaf.ColorUIResource" id="color">
        <int>255</int>
        <int>0</int>
        <int>0</int>
    </object>
    <property key="Table.gridColor" type="idref" value="color"/>
</style>
<bind style="tableStyle" type="region" key="Table"/>


enter code here

看到这张图片

Is it possible to implement styles in images through XML configuration? thanks.

Synth L&F is only prototype to build your own L&F. But some basic things like selection color are implemented here.

    <state value="SELECTED">
        <color type="TEXT_BACKGROUND" value="#00538c" />
        <color type="TEXT_FOREGROUND" value="#ffffff" />
        <color type="FOREGROUND" value="#FFFFFF" />
    </state>    

But I also haven't found how to change grid color of a table header using Synth L&F

If you want to style your GUI using XML, you probably need to switch to JavaFX. Another possibility is to buy Synthetica L&F, which is based on Synth L&F. It has almost all features you need to style your GUI. But it has one disadvantage: you need lots of time to learn it and all its features (and workaronds for its bugs of course ;) ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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