public static @Nullable ContentManager getContentManager(@Nullable Component component) {
    return component instanceof MyNonOpaquePanel o ? o.getContentManager() : null;
  }
public static @Nullable ContentManager getContentManager(@Nullable Component component)