I've built a custom TreeModel for my Java application and, as part of that, have set up my model to fire TreeModelListener events. The docs say to call treeStructureChanged() when the tree has drastically changed structure from a node down but I'm unclear what this means for actually using it. When should my TreeModel call treeStructureChanged()?
Asked
Active
Viewed 921 times
2 Answers
2
Taken from this link (site changed and link is wrong now)
In order to notify a listener of multiple inserts and deletes, or to identify changes at multiple levels in the tree, you use treeStructureChanged() and use the simple, no-children TreeModelEvent. In this case, the path argument specifies a node in the tree that did not change, and which has all of the other changes below it.

Aleksandr Kravets
- 5,750
- 7
- 53
- 72

Sujay
- 6,753
- 2
- 30
- 49
1
When you implement the TreeModelListener, the callbacks (including treeStructureChanged) help in detecting when the tree changes. treeStructureChanged callback is invoked in case of multiple inserts/deletes or if there are changes at multiple levels in the tree. hope it helps

ali haider
- 19,175
- 17
- 80
- 149