@Contract(pure = true)
  public static @Nullable <T> T getStrictParentOfType(@NotNull Class<? extends T> type, Component component) {
    while (component != null) {
      component = component.getParent();
      if (type.isInstance(component)) {
        //noinspection unchecked
        return (T)component;
      }
    }
    return null;
  }
@Contract(pure = true)
  public static @Nullable <T> T getStrictParentOfType(@NotNull Class<? extends T> type, Component component)