Refreshing JTree

I already find that refreshing JTree trouble is usual question - but never seen answer on my problem.

i am using JTree and model implementing FileTreeModel. i have popup menu with "delete file" for example and when i m pushing it - i do the following code:

boolean success = (new File(tTreePath.getLastPathComponent().toString())).delete();

so the file became dead, but it still presents in JTree (like directory btw). Using JTree. repaint / validate / setVisibility doesnt help - is there any other way (pref without changing tree model)

[629 byte] By [Alantiea] at [2007-11-27 11:50:43]
# 1

TreePath tpath = // return treePath

treeModel.removeNodeFromParent( (MutableTreeNode)tpath.getLastPathComponent( );

And by the way, if you searched harder, you might have found your answer on the forum

ICE

[Edit]

This cannot be done without updating or modifying the model

icewalker2ga at 2007-7-29 18:33:37 > top of Java-index,Desktop,Core GUI APIs...
# 2

as i wrote TreeModel is not DefaultTreeModel, but FileTreeModel dont have such functions as RemoveNodeFromParent.

Also tree nodes are Files - not MutableTreeNode.

Thats why i have the problem and thats why i wrote=(

Btw the code u posted doesnt work in all cases too - TreeModel still needs reload after it...

Alantiea at 2007-7-29 18:33:37 > top of Java-index,Desktop,Core GUI APIs...