S
soup_or_power
Hi Zero
Thank you for helping me out. I've a new problem now. I am trying to
save the JTree state to a DB. I've narrowed down the following 2
functions. I am wondering about how to save the variable "paths" (pl.
see code below) so that the tree can be recreated. What goes into the
vector?
Thank you
<begin code snippet>
Vector paths
public void saveTreePaths() {
Object path = selectionTree.getModel().getRoot();
paths = new Vector();
TreePath tp = new TreePath(path);
nodes = selectionTree.getExpandedDescendants(tp);
while(nodes.hasMoreElements()) {
paths.add(nodes.nextElement());
}
}
public void reloadTreePath() {
for(int j = 0; j < paths.size(); j++) {
TreePath Path = (TreePath) paths.get(j);
selectionTree.expandPath(Path);
}
}
<end code snippet>
Thank you for helping me out. I've a new problem now. I am trying to
save the JTree state to a DB. I've narrowed down the following 2
functions. I am wondering about how to save the variable "paths" (pl.
see code below) so that the tree can be recreated. What goes into the
vector?
Thank you
<begin code snippet>
Vector paths
public void saveTreePaths() {
Object path = selectionTree.getModel().getRoot();
paths = new Vector();
TreePath tp = new TreePath(path);
nodes = selectionTree.getExpandedDescendants(tp);
while(nodes.hasMoreElements()) {
paths.add(nodes.nextElement());
}
}
public void reloadTreePath() {
for(int j = 0; j < paths.size(); j++) {
TreePath Path = (TreePath) paths.get(j);
selectionTree.expandPath(Path);
}
}
<end code snippet>