class AsyncIcon implements Icon {

  AsyncIcon(@NotNull CompletableFuture<? extends Icon> futureIcon,
                   @NotNull Icon placeholderIcon,
                   @Nullable Runnable onIconLoad) {
    myIcon = placeholderIcon;
    myW = placeholderIcon.getIconWidth();
    myH = placeholderIcon.getIconHeight();

    futureIcon.whenComplete((result, e) -> {
      if (e != null) {
        Logger.getInstance(AsyncIcon.class).warn("Unable to load AsyncIcon", e);
        return;
      }

      if (result != null) {
        myIcon = result;
      }

      if (onIconLoad != null) {
        onIconLoad.run();
      }
    });
  }

    AsyncIcon(@NotNull CompletableFuture<? extends Icon> futureIcon,
                   @NotNull Icon placeholderIcon,
                   @Nullable Runnable onIconLoad);

}