B
Barb
The following code is supposed to expand a tree once a new node has
been added. Unfortunately it does not and I do not know why. Can
anyone help?
if (editPolicy == Constants.Gen_AsNew) {
// For new, first build a new Node Object with
// all default blank values
// If saved, then add to tree
navTreeModel.insertNodeInto(
treeNode, parentTreeNode,
parentTreeNode.getChildCount()
);
// XXX JS 16/1/3 this expansion doesn't work - don't know why !
// Get the index of the parentNode, and
// then expand the tree for the current index
int i =
navTreeModel.getChildCount(this.parentTreeNode) - 1;
TreeNode[] theNodes = navTreeModel.getPathToRoot(
(TreeNode) navTreeModel.getChild(
this.parentTreeNode, i
)
);
TreePath theNodePath = new TreePath(theNodes);
navTree.expandPath(theNodePath);
navTree.repaint();
Any help would be greatly appreciated.
Thanks Barb
been added. Unfortunately it does not and I do not know why. Can
anyone help?
if (editPolicy == Constants.Gen_AsNew) {
// For new, first build a new Node Object with
// all default blank values
// If saved, then add to tree
navTreeModel.insertNodeInto(
treeNode, parentTreeNode,
parentTreeNode.getChildCount()
);
// XXX JS 16/1/3 this expansion doesn't work - don't know why !
// Get the index of the parentNode, and
// then expand the tree for the current index
int i =
navTreeModel.getChildCount(this.parentTreeNode) - 1;
TreeNode[] theNodes = navTreeModel.getPathToRoot(
(TreeNode) navTreeModel.getChild(
this.parentTreeNode, i
)
);
TreePath theNodePath = new TreePath(theNodes);
navTree.expandPath(theNodePath);
navTree.repaint();
Any help would be greatly appreciated.
Thanks Barb