IconButton add pressed icon override

This commit is contained in:
SiboVG 2022-08-25 10:15:40 +02:00
parent 1c38aa4dd4
commit aa0c119a58

View File

@ -38,6 +38,13 @@ public class IconButton extends SelectColorButton {
setIconTextGap(ICON_GAP);
}
@Override
public void setIcon(Icon defaultIcon) {
super.setIcon(defaultIcon);
// There is a bug where the normal override of the pressed icon does not work, so we have to assign it here.
setPressedIcon(Icons.getScaledIcon(defaultIcon, ICON_SCALE));
}
@Override
public Icon getIcon() {
return Icons.getScaledIcon(super.getIcon(), IconButton.ICON_SCALE);