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(); int startRow = tree.getRowCount() - 1; String prefix = "b"; TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Backward); System.out.println(path); } }