展开 折叠 JeditorPane
我正在创建一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是折叠代码的示例。
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
您可以查看
org.netbeans.swing.outline
,如本答案中所述。因为Outline
扩展JTable
,自定义 渲染相对容易。我会放一个Outline
位于左侧,JEditorPane
位于JSplitPane
右侧;使用ListSelectionListener
相应地更新JEditorPane
。You might look at
org.netbeans.swing.outline
, as discussed in this answer. BecauseOutline
extendsJTable
, custom rendering is relatively easy. I'd put anOutline
on the left and aJEditorPane
on the right of aJSplitPane
; use aListSelectionListener
to update theJEditorPane
accordingly.