Modelo de árbol personalizado de Java: uso de treeStructureChanged ()

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

También es posible que desee comprobar esta respuesta. -

2 Respuestas

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.

Respondido el 25 de diciembre de 12 a las 13:12

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

Respondido 04 Jul 12, 01:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.