0

I read a lot of articles regarding this problem but I was not able to make head no tail of them.

My Problem:

I implemented an custom TreeModel (which implements the interface "TreeModel") and defined the methods like getRoot(), isLeaf() etc. This works great for me, but deleting a node in the view will not be shown. I have to switch to another view in the program and get back after that to see the changed JTree (so the JTree is propably reestablished after switching back).

So, how can I refresh the model in the current view with a custom TreeModel (I'm not using the DefaultTreeModel)?

I look forward to hearing from you! Thanks a lot :)

  • Some code or fiddle would be helpful. – Yauheni Leichanok Mar 26 '14 at 11:37
  • I recommend you to use [`DefaultTreeModel`](http://docs.oracle.com/javase/7/docs/api/javax/swing/tree/DefaultTreeModel.html) with your customizations of methods, because it's easier. For example you can use inside model `fireTreeNodesRemoved`, `fireTreeStructureChanged` and other events after changing nodes. Or you can implement that methods inside your custom `TreeModel`. – alex2410 Mar 27 '14 at 06:53

0 Answers0