Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can i make JTree show all nodes in the tree,when the data structure changed  RSS feed

 
Dingcheng lee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my application ,i want to show every nodes whenever i am change the data and the data structure.how can i implement it.
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dingcheng lee:
in my application ,i want to show every nodes whenever i am change the data and the data structure.how can i implement it.

Create a TreeModel. Associate tree model with the JTree. Add TreeModelListener to the TreeMOdel. And in the treeNodesChanged(TreeModelEvent)method, use expandPath(TreePath path) or expandRow(int row)
methods of JTree.
Enjoy!
[ September 15, 2003: Message edited by: Murthy Narasimha ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!