Hi, I am facing a problem as described below:
A new node is added to JTree and then I am sorting the nodes. After sorting completes, I want the newly added node should be highlighted. I used parent path of the new added node and called jtree.scrollPathToVisible(parentPath); jtree.setSelectionPath(parentPath);. but its not working. Please help
As you are calling setSelectionPath on the parent node, logically, the parent would be selected. If you want the parent to be expanded, then you should call expandPath().
Ok, then, you will have to create a small runnable program that reproduces the problem and post the code. This is called SSCCE. Volunteers here can then take that program and run it and see.