Java Swing table tree

2019-01-11 23:51发布

When you open a XML in Eclipse, the content can be shown in as a tree structure like

XML tree view

The tree is "embedded" in a table and the content is showed in a seperate column.

This would be very nice to replicate in Swing, not for XML content specifically, but for similar data with tree structure.

UPDATE

I just learned about JTreeTable, but I really need to do this in NetNeans. Should probably have mentioned that, sorry.

Any ideas?

3条回答
Luminary・发光体
2楼-- · 2019-01-12 00:12

SwingX has a JXTreeTable, it's based on but much improved over the oldish examples (links to sun code/article) cited by @mKorbel

查看更多
时光不老,我们不散
3楼-- · 2019-01-12 00:12

Check the following:

查看更多
做自己的国王
4楼-- · 2019-01-12 00:19

You could try subclassing JTable and making your own custom renderer with behavior that adds/removes new rows when you expand/collapse a node.

查看更多
登录 后发表回答