How can I force JTree to display changing nodes added at runtime?
Created May 7, 2012
The JTree will wait for update notification before changing its display. This allows you to add several nodes in one batch before it repaints.
Depending on the tree model you're using you'll probably need to call a method like
model.fireTreeStructureChanged()
If you're using the default tree model, see the Javadocs; if you're using a custom tree model, make sure you provide a way to fire the events. (In general, you shouldn't automatically fire the events when new nodes are added, unless the model is really meant to force updates to the view for each node. This can really slow things down and cause a lot of "flicker" if you add several nodes at once)