This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree update  RSS feed

 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi javers.
I have one question about updating the tree.
I have JTree object in my application that reads files on my computer. How I can update this tree if i created new file from my application.
I tryed to use model.reload(node) method, but this method paints twice old files and once new file.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
you should have implemented your own tree model that has some method "addFile" or "addNode", whatever. in this method you should call fireTreeNodeInserted of fireTreeStructureChanged whenever the tree actually changed. JTree will listen to this events and update automatically.
Chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!