public static TreePath getNextMatch(JTree tree, String prefix) {
		int max = tree.getRowCount();
		if (prefix == null) {
	    	throw new IllegalArgumentException();
		}

		// start search from the next/previous element froom the selected element
		int row = 0;
		do {
		    TreePath path = tree.getPathForRow(row);
		    String text = tree.convertValueToText(path.getLastPathComponent(), tree.isRowSelected(row), tree.isExpanded(row), true, row, false);
		    
		    if (text.startsWith(prefix)) {
				return path;
		    }
		    row = (row + 1 + max) % max;
		} while (row != 0);
		
		return null;
    }