如何将Java JTree设置为看起来像是用于xml文档?

时间:2022-06-30 12:38:07

I have a JTree and the default look-and-feel of the icons and such look like it's meant for a file structure (with folder and document icons).

我有一个JTree和图标的默认外观,看起来像是文件结构(带文件夹和文档图标)。

I'm wondering how I can override the look-and-feel programmatically, or via a library (Is there an XML JTree library?).

我想知道如何以编程方式覆盖外观,或者通过库(是否有XML JTree库?)。

1 个解决方案

#1


0  

There's a very good example explained here along with source code.
It's via getTreeCellRendererComponent() which you can further customize.
It's also optimized for performance.

这里有一个非常好的例子和源代码。它是通过getTreeCellRendererComponent()进行进一步自定义的。它还针对性能进行了优化。

#1


0  

There's a very good example explained here along with source code.
It's via getTreeCellRendererComponent() which you can further customize.
It's also optimized for performance.

这里有一个非常好的例子和源代码。它是通过getTreeCellRendererComponent()进行进一步自定义的。它还针对性能进行了优化。