Updating a jtree

If a query method detects an change, it must suppress it (i.e.

return the old state) and only perform the change and deliver events with Swing Utilities.invoke Later().

UPDATE 2: My problem was not how to notify the viewer (the JTree), but rather in what way should the jtree be reloaded after the notification from the model.

First of all let me say that the only way i know to refresh a tree to reflect underlying changes, is to call the update UI(), or reuse the set Model() method.

Your JTree is updated is some thread, but the important copy of the JTree, the one that is displayed in the Swing event dispatch thread (EDT), knows nothing of those changes.Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. You select 'Colour' and all the data from the tree is grouped into colours, a new tree is built and .... Hi all, after editing a node in a jtree, how do i refresh this node so that the changes appear immediately.tree.update UI(); works fine, but all nodes collapse, so i want to update only the changed node (or prevent the collapse-thing).

Leave a Reply