How to: JTable with collapsible JTree in first column and data in the other columns?
Asked Answered
L

1

8

I am somewhat lost at this point: I try to create a JTable that is able to hold some kind of a Tree (JTree?) datastructure in the first column followed by data based on the tree Node in the other columns as illustrated in the following image:

enter image description here

That image shows the structure of my JTree. The red lines indicate the table structur that i would need to realize. Each Node in the Tree should be treatet like a single row in that table, etc. I hope it is clear what i try to achieve.

I tried an aproach like it was discussed here: JTable as a JTree Node and here Put JTable in the JTree but that doesn't fit my needs. I also read about the JXTreeTable from the SwingX project but it seems to be very hard to find any usefull examples. Also many links to solutions like this seem to lead to (no longer existing) sun websites and/or beeing redirected to the oracle site...

It would be awesome if someone could lead me into the right direction and/or provide some exmaple code on how to do this (right).

Any help would be appreciated ;).

Lavone answered 20/11, 2013 at 12:54 Comment(0)
D
7

Create your own TreeTable component like in the following link : http://www.java2s.com/Code/Java/Swing-Components/JTreeTablecomponent.htm

Depreciation answered 20/11, 2013 at 13:14 Comment(1)
thx a lot, looking into it right now. also just stumbeled over this one: JavaSwingTreeTable . seems to be exactly what i need!Lavone

© 2022 - 2024 — McMap. All rights reserved.