JTree Java Update

I have a JTree that I use to display some (not surprisingly) hierarchical data. Part of the specification is that the user can change the data source (atm is only between files). Now, when this happens, I can restore data and tree nodes without any problems. But I am having significant difficulties getting a tree for updating changes. I tried to remove it from it scrollpane and replace it with a new JTree, but I have not seen such. I tried to remove everything from JTree and did not see any effect.

How can I change the display of a JTree display after building it?
Ninjedit: Yes, I called updateUI ().

Other editing: I also wanted to replace the current tree data with my new data. However, I do not see any methods that will use the DefaultMutableTreeNode that I created. Even if I just remove the JTree and call updateUI on it containing the ScrollPane, nothing will happen. Or if I use redrawing instead.

+3
source share
1 answer

, ( JTree) . , node.add(...), , model.insertNodeInto(...) ( , DefaultTreeModel). , , (JTree). , , , , .
, JTree, , , DefaultTreeModel .

, Sun JTree, ?

+5

Source: https://habr.com/ru/post/1759169/


All Articles