void (final Icon regular, Icon inactive, Icon hovered) { if (regular == null) return; if (inactive == null) inactive = regular; if (hovered == null) hovered = regular; int width = Math.max(regular.getIconWidth(), inactive.getIconWidth()); width = Math.max(width, hovered.getIconWidth()); int height = Math.max(regular.getIconHeight(), inactive.getIconHeight()); height = Math.max(height, hovered.getIconHeight()); JBDimension size = JBDimension.create(new Dimension(width, height), true); if (mySize != null && !mySize.size().equals(size)) { invalidate(); } mySize = size; Icon oldIcon = myIcon; myIcon = regular; myRegular = new CenteredIcon(regular, width, height); myHovered = new CenteredIcon(hovered, width, height); myInactive = new CenteredIcon(inactive, width, height); firePropertyChange(AbstractButton.ICON_CHANGED_PROPERTY, oldIcon, regular); }