boolean (@NotNull Component ancestor, @Nullable Component descendant) { while (descendant != null) { if (descendant == ancestor) { return true; } descendant = descendant.getParent(); } return false; }