Icon (@Nullable Icon mrIcon, @Nullable ScaleContext scaleContext) { if (mrIcon == null) { return null; } if (scaleContext == null) { scaleContext = ScaleContext.create(); } Image image = Objects.requireNonNull(IconLoader.toImage(mrIcon, scaleContext)); if (!(image instanceof MultiResolutionImage)) { return mrIcon; } image = getMaxSizeResolutionVariant(image); image = ImageUtil.ensureHiDPI(image, scaleContext); return new JBImageIcon(image); }