Click here to Skip to main content
15,903,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how will I display the new node added to the mother node in a JTree object...?
My code displays the first child node created but not the second or the third and so on how will I display the other child nodes created...? Please help...

What I have tried:

String strRep=null;
       strRep=getID(); // this function returns null or a string value
       protected static DefaultTreeModel treeModel;// declared in class level
       boolean shouldBeVisible=true;
	       String path=System.getProperty("user.dir");
        // getRepositoryName returns a string     
		File Cr=new File(path + "/" + getRepositoryName() );
		DefaultMutableTreeNode nrep=new DefaultMutableTreeNode(getRepositoryName());
		            treeModel.insertNodeInto(nrep, rep, rep.getChildCount());
            tree.scrollPathToVisible(new TreePath(nrep.getPath()));
Updated 23-Jun-22 3:53am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900