Reputation: 11
I want to create a jtree with nodes of jtable and that jtable should be editable when I click on a cell. Please respond ASAP it's important to my project.
Upvotes: 1
Views: 2049
Reputation: 205785
As an alternate design, consider JSplitPane
: one pane would hold the JTree
, while the other displays the JTable
corresponding to the selected tree node. See Responding to Node Selection for details.
Upvotes: 2
Reputation: 6969
You need a custom Renderer / custom Editor. Check out these tutorials:
one tutorial: http://www.java2s.com/Tutorial/Java/0240__Swing/CreatingaCustomRenderer.htm
basic swing tutorial on trees: http://download.oracle.com/javase/tutorial/uiswing/components/tree.html
another swing tutorial, talks about custom editors for tables but trees are similar - http://download.oracle.com/javase/tutorial/uiswing/components/table.html#editor
Similar question asked here: Using JTable for a JTree cell editor
Try these, let us know if you're still stuck
Upvotes: 1