展开 折叠 JeditorPane

发布于 2024-09-27 02:13:36 字数 72 浏览 1 评论 0原文

我正在创建一个 XMl 编辑器。我希望 JeditorPane 具有根据节点展开折叠功能。如果有人知道如何做到这一点,请告诉...

I am creating a XMl editor. I want the JeditorPane to have expand collapse feature accoring to nodes.. If anybody is having any idea how to do it please tell...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空城缀染半城烟沙 2024-10-04 02:13:36

这是折叠代码的示例。
http://java-sl.com/collapse_area.html
以及 XMLEditorKit 的另一个示例(带有展开/折叠节点)
http://java-sl.com/xml_editor_kit.html

问候,
斯塔斯

That's an example of folding code.
http://java-sl.com/collapse_area.html
and one more exmple of XMLEditorKit (with expanding/collapsing nodes)
http://java-sl.com/xml_editor_kit.html

Regards,
Stas

一桥轻雨一伞开 2024-10-04 02:13:36

您可以查看 org.netbeans.swing.outline,如本答案中所述。因为 Outline 扩展 JTable,自定义 渲染相对容易。我会放一个 Outline 位于左侧,JEditorPane 位于 JSplitPane 右侧;使用 ListSelectionListener 相应地更新 JEditorPane

You might look at org.netbeans.swing.outline, as discussed in this answer. Because Outline extends JTable, custom rendering is relatively easy. I'd put an Outline on the left and a JEditorPane on the right of a JSplitPane; use a ListSelectionListener to update the JEditorPane accordingly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文