Andy_Hollywood
Apr 14th, 2003, 07:27 AM
Hello
I have the following code:
DefaultMutableTreeNode child = new DefaultMutableTreeNode(this.ri);
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)(this.registry.tree.getLastSelectedPathComponent());
if (parent == null) {
parent = this.registry.rootnode;
}
this.registry.treeModel.insertNodeInto(child, parent, parent.getChildCount());
this.registry.tree.scrollPathToVisible(new TreePath(child.getPath()));
and what i thought should happen is that it would add the child then re-open the tree to display tot he correct path, alas it does not, and i don't have any idea why not, it does add the node properly, as when i click ok etc.. my prog write it all to a datbase then when i open the app again it re-creates the tree except this time with the node int he correct place....
Am i doing somethign very wrong? or do i need to go into more depth?1
Cheers
Andy
I have the following code:
DefaultMutableTreeNode child = new DefaultMutableTreeNode(this.ri);
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)(this.registry.tree.getLastSelectedPathComponent());
if (parent == null) {
parent = this.registry.rootnode;
}
this.registry.treeModel.insertNodeInto(child, parent, parent.getChildCount());
this.registry.tree.scrollPathToVisible(new TreePath(child.getPath()));
and what i thought should happen is that it would add the child then re-open the tree to display tot he correct path, alas it does not, and i don't have any idea why not, it does add the node properly, as when i click ok etc.. my prog write it all to a datbase then when i open the app again it re-creates the tree except this time with the node int he correct place....
Am i doing somethign very wrong? or do i need to go into more depth?1
Cheers
Andy