Adding folder to tree
Hi,
I am using this code snippet to adding this node(directory) into tree and make
it visible in the File system view. I cann't use insert node into bcoz i am not using
defaultTreemodel.
TreePath selectedPath = tree.getSelectionPath();
File NewFile = new File(selectedPath.getLastPathComponent().toString(), "NewFolder");
NewFile.mkdir();
selectedPath = selectedPath.pathByAddingChild(NewFile);
tree.scrollPathToVisible(selectedPath);
tree.setSelectionPath(selectedPath);
tree.requestFocus();
FileBrowseTree class is my cutomized TreeModel.
These r the execption i am getting when i am trying to close(collapsing or expanding)
the parent node in which i have added the node recently.This May be bcoz of not updating the
tree model.
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at FileBrowseTree.FileBrowseTree$3.valueChanged(FileBrowseTree.java:109)
at javax.swing.JTree.fireValueChanged(JTree.java:2399)
What would be the best way to insert the node into the tree?
Why i am facing this problem?
Thanks in advance,
Arun

