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()?
preguntado el 04 de julio de 12 a las 01:07
Tomado de este enlace (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.
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