Merge pull request #2566 from SiboVG/issue-2565

[#2565] Check if icon is imageicon for icon disabling
This commit is contained in:
Sibo Van Gool 2024-10-02 18:56:29 +02:00 committed by GitHub
commit ee672c77b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -187,6 +187,9 @@ public class Icons {
}
public static Icon createDisabledIcon(Icon icon) {
if (!(icon instanceof ImageIcon)) {
return icon;
}
Image image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
icon.paintIcon(null, g, 0, 0);