Hi, I've been working on building a incremental search for my jtree that is built in an XML file.
When the tree is loaded I want the user to be able to be able to search the tree. Currently I can search the tree if it is expanded. But i want it to search all nodes and child nodes w/o expanding. I tried to expanding the tree, but it becomes very slow.
Also It only finds the first matching node. Any help would be appreciated.
This is what performs the search:
String prefix = this.jTextField1.getText();
for (int i = 0; i < tree.getRowCount(); i++) {
TreePath path = tree.getNextMatch(prefix, i, Position.Bias.Forward);
tree.expandPath(path);
tree.setSelectionPath(path);
tree.makeVisible(path);
}
thanks,