• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to update the nodes after a deletion in jtree

 
prajna pa
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
prajna pa
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had created a delete button in my gui and given the action listener to delete the file or folder.
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic