【问题标题】:Setting custom look and feel on specific Swing components在特定的 Swing 组件上设置自定义外观
【发布时间】:2013-02-25 14:42:50
【问题描述】:

是否可以在 Swing GUI 上仅设置用于特定组件或组件集的 Synth 外观的文件,而无需为任何其他组件更改它?

【问题讨论】:

  • LAF 是在创建组件时分配的。因此,您可以设置 LAF,创建组件,然后将 LAF 重置为主 LAF。我不确定这是否会 100% 有效。
  • 对于example

标签: java swing look-and-feel synth


【解决方案1】:

是的,这是可能的。将类型设置为“区域”将其更改为“名称”,将值设置为由 setName(“componentName”) 给出的特定名称;应用程序中的方法。

添加这个

<style id="titleBarButtonsPanel">
    <state>
        <opaque value="false" /><!-- background of the title bar -->

        <insets top="0" left="0" bottom="0" right="0" /><!-- size of the 
            title bar -->

        <color value="red" type="BACKGROUND" />
        <color value="white" type="FOREGROUND" />

    </state>
</style> <bind style="titleBarButtonsPanel" type="name" key="NameOfSpecificComponent" />

在程序中添加 setName("NameOfSpecificComponent");

【讨论】:

    猜你喜欢
    • 2012-11-01
    • 2011-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多