public static @Nullable TreePath nextVisiblePath(@NotNull JTree tree, int row, boolean cyclic,
                                                   @NotNull Predicate<? super TreePath> predicate) {
    assert EventQueue.isDispatchThread();
    if (row < 0) return null; // ignore illegal row
    int count = tree.getRowCount();
    if (count <= row) return null; // ignore illegal row
    int stop = row;
    while (true) {
      row++; // NB!: increase row before checking for cycle scrolling
      if (row == count && cyclic) row = 0;
      if (row == count) return null; // stop scrolling on last node if no cyclic scrolling
      if (row == stop) return null; // stop scrolling when cyclic scrolling is done
      TreePath path = tree.getPathForRow(row);
      if (path != null && predicate.test(path)) return path;
    }
  }
public static @Nullable TreePath nextVisiblePath(@NotNull JTree tree, int row, boolean cyclic,
                                                   @NotNull Predicate<? super TreePath> predicate)