Set icon in caption of dialog

When i extends DialogsImpl and i override MessageDialogBuilder withCaption . i want to set an Icon in the caption of dialog but the caption need return in String and not show the icon like i want .

HI,

The JmixWindow object that is used to display a result dialog has the setIcon method. You can add withIcon(String) method to your extension and use it, e.g.:

public CustomMessageDialogBuilder withIcon(@Nullable String icon) {
    if (icon == null) {
        window.setIcon(null);
    } else {
        IconResolver iconResolver = applicationContext.getBean(IconResolver.class);
        window.setIcon(iconResolver.getIconResource(icon));
    }

    return this;
}

Result:
Screenshot 2023-04-28 at 15.41.31

Regards,
Gleb