aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to update the nodes after a deletion in jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to update the nodes after a deletion in jtree" Watch "How to update the nodes after a deletion in jtree" New topic
Author

How to update the nodes after a deletion in jtree

prajna pa
Ranch Hand

Joined: Oct 04, 2012
Posts: 36
hi..

here i am adding all the files and folders from the specified path.(example d:\\ java\\time\\ --> all the files and folders under 'time' should display in jtree,it is working )

i am finding the problem in updating that is i am deleting the selected file/folder by clicking on the delete button and after deletion the jtree is not updating .
if i load the program again then it is updating .. so please help me how to solve this problem.

thanks in advance

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

prajna pa wrote:i am finding the problem in updating that is i am deleting the selected file/folder by clicking on the delete button and after deletion the jtree is not updating .
if i load the program again then it is updating .. so please help me how to solve this problem.

So where is this delete button? On your UI?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
prajna pa
Ranch Hand

Joined: Oct 04, 2012
Posts: 36
i had created a delete button in my gui and given the action listener to delete the file or folder.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

In your action performed, after deleting the file, are you removing the corresponding node from the tree model?
Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html especially the Dynamically Changing the tree section
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to update the nodes after a deletion in jtree