I can add nodes to my JTree, but after expanding a node, I can not add any child nodes to that node, or at least they dont show on the screen? Actually I can use the .add(new DefaultMutableTreeNode("Label")); to add a node to a parent node, but the new child node doesn't show on the display of the JTree?

Any help appreciated,
Jon

You will need to refresh the display to make it show up.

use the tree model's insertNodeInto(), it should fire the appropriate events for updating the view.

Hi I am facing exactly the same problem. Did you find a solution to this? I want to avoid using treemodel here since my tree is a static variable. I don't want to play around with objects at the moment.. Will involve a lot of restructuring of code.
Please help !!!

It appears TreeModel is the only solution to this problem... !!! i used that and it is now working fine for me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.