Finding a Node in a JTree Component
import javax.swing.JTree; import javax.swing.text.Position; import javax.swing.tree.TreePath; public class Main { public static void main(String[] argv) throws Exception { JTree tree = new JTree(); // Search forward from first visible row looking for any visible node // whose name starts with prefix. int startRow = 0; String prefix = "b"; TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Forward); System.out.println(path); } }