Java Swing table tree

我是研究僧i 提交于 2019-11-26 22:24:25

问题


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

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?


回答1:


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




回答2:


Check the following:

  • TreeTable
  • This example
  • Code depots by Swing Guru
  • Netbeans IDE's Outline
  • Something more here
  • Commercial products



回答3:


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



来源:https://stackoverflow.com/questions/7122901/java-swing-table-tree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!