简体   繁体   English

Synth外观用户XML如何更改JTable和JTree?

[英]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. 我想通过Synth LookAndFeel xml配置更改JTableJTree样式。 But I only found that a small part can be implemented through the xml file configuration(eg. high-line, cell-color...). 但是我只发现一小部分可以通过xml文件配置来实现(例如, xml ,单元格颜色...)。 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? 是否可以通过XML配置在图像中实现样式? thanks. 谢谢。

Synth L&F is only prototype to build your own L&F. Synth L&F只是构建您自己的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 但是我也还没有发现如何使用Synth L&F更改表格标题的网格颜色

If you want to style your GUI using XML, you probably need to switch to JavaFX. 如果要使用XML设置GUI样式,则可能需要切换到JavaFX。 Another possibility is to buy Synthetica L&F, which is based on Synth L&F. 另一种可能性是购买基于Synth L&F的Synthetica L&F。 It has almost all features you need to style your GUI. 它几乎具有样式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 ;) ). 但是它有一个缺点:您需要花费很多时间来学习它及其所有功能(当然还有其错误的工作原理;)。

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

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