开发者

How to make jtable as a node of jtree

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开发者_StackOverflow.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜