Icon (@NotNull ScaleContext context, @NotNull Object source) { if (source instanceof ImageIcon) { Image image = ((ImageIcon)source).getImage(); if (image instanceof JBHiDPIScaledImage) { return wrapHiDPI(context, (JBHiDPIScaledImage)image); } return (Icon)source; } if (source instanceof JBHiDPIScaledImage) { return wrapHiDPI(context, (JBHiDPIScaledImage)source); } if (source instanceof Image) { return new JBImageIcon((Image)source); } return (Icon)source; }