Set the drawable that is used as this button's icon.
@param icon The drawable.
@param animation Indicate should show animation when switch drawable or not.
337422
public void setIcon(Drawable icon, boolean animation){
        if(icon == null)
            return;

        if(animation) {
            mSwitchIconAnimator.startAnimation(icon);
            invalidate();
        }
        else{
            if(mIcon != null){
                mIcon.setCallback(null);
                unscheduleDrawable(mIcon);
            }

            mIcon = icon;
            float half = mIconSize / 2f;
            mIcon.setBounds((int)(mBackground.getCenterX() - half), (int)(mBackground.getCenterY() - half), (int)(mBackground.getCenterX() + half), (int)(mBackground.getCenterY() + half));
            mIcon.setCallback(this);
            invalidate();
        }
	}
170799
public UIImage setIcon(GuiIcon icon)
	{
		this.itemStack = null;
		this.icon = icon;
		setForeground(ICON_RENDER);
		return this;
	}
1349504
public void setIcon(final Image IMAGE) {
        if (null == icon) {
            _icon = IMAGE;
            fireSectionEvent(UPDATE_EVENT);
        } else {
            icon.set(IMAGE);
        }
    }
602654
public void setImageUI(final BufferedImage image) {
		BoofSwingUtil.invokeNowOrLater(() -> {
			repaintJustImage(ImagePanel.this.img,adjustmentGUI);
			ImagePanel.this.img = image;
			repaintJustImage(ImagePanel.this.img,adjustmentGUI);
		});
	}
714203
public void setSelectionDrawable(@NonNull Drawable drawable) {
    if (drawable == null) {
      throw new IllegalArgumentException("Cannot be null");
    }
    selectionDrawable = drawable;
    isDecorated = true;
  }
1244495
public void setSideIcons(Icon[] icons)
	{
		for (int i = 0; i < icons.length; i++)
		{
			if (icons[i] != null)
				setSideIcon(EnumFacing.getFront(i), icons[i]);
		}
	}
1316561
public void show(boolean animated) {
        if (animated) {
            if (visibilityChangeListener != null) {
                visibilityChangeListener.onAlertAppearStarted(this);
            }
            startAnimation(fadeInAnimation);
        }
        else {
            setVisibility(VISIBLE);
        }
    }
480687
private void setViewDrawable(ImageView v, Drawable drawable, int nullVisibility) {
        // Set the icon even if the drawable is null, since we need to clear any
        // previous icon.
        v.setImageDrawable(drawable);

        if (drawable == null) {
            v.setVisibility(nullVisibility);
        } else {
            v.setVisibility(View.VISIBLE);

            // This is a hack to get any animated drawables (like a 'working' spinner)
            // to animate. You have to setVisible true on an AnimationDrawable to get
            // it to start animating, but it must first have been false or else the
            // call to setVisible will be ineffective. We need to clear up the story
            // about animated drawables in the future, see http://b/1878430.
            drawable.setVisible(false, false);
            drawable.setVisible(true, false);
        }
    }
1022581
private void setParentIcon(boolean iconify) {
        if (rootParent instanceof JFrame) {
            JFrame frame = (JFrame) rootParent;
            int    state = frame.getExtendedState();

            ((JFrame) rootParent).setExtendedState(iconify ? state | Frame.ICONIFIED : state & ~Frame.ICONIFIED);
        }
    }
538762
public void setIconType(IconType type) {
        IconType prevType = iconType;
        iconType = type;
        if (iconType != prevType && iconElement != null) {
            iconElement.removeFromParent();
            iconElement = null;
            DomEvent.fireNativeEvent(Document.get().createChangeEvent(), this);
        }
    }
748836
public IconProviderBuilder connectedWith(Icon icon)
	{
		setType(Type.CONNECTED);
		connectedIcon = Objects.requireNonNull(icon);
		return this;
	}
727702
private void setChildDrawableAtIndex(int index, @Nullable Drawable drawable) {
    if (drawable == null) {
      mFadeDrawable.setDrawable(index, null);
      return;
    }
    drawable = WrappingUtils.maybeApplyLeafRounding(drawable, mRoundingParams, mResources);
    getParentDrawableAtIndex(index).setDrawable(drawable);
  }
1369639
public void setIcon(FontOpenCms icon, String color) {

        if (icon != null) {
            m_iconCell.setInnerHTML(icon.getHtml(32, color));
        } else {
            m_iconCell.setInnerHTML("");
        }
    }
461881
public function setIcon($icon) {
		if (isset($this->_icon)) {
			$this->removePropertyValue("class", $this->_icon);
		}
		$this->_icon=$icon;
		$this->addToProperty("class", $icon);
		return $this;
	}
408188
public void setLineMorphingState(int state, boolean animation){
		if(mIcon != null && mIcon instanceof LineMorphingDrawable)
            ((LineMorphingDrawable)mIcon).switchLineState(state, animation);
	}
1056589
public final void setDialogIcon(@DrawableRes final int resourceId) {
        this.dialogIcon = AppCompatResources.getDrawable(getContext(), resourceId);
        this.dialogIconBitmap = null;
        this.dialogIconId = resourceId;
    }
270595
public void startBackgroundIconColorFadeAnimation(final int cycleCount) {
        if (backgroundIcon == null) {
            LOGGER.warn("Background animation skipped because background icon not set!");
            return;
        }
        backgroundIconColorFadeAnimation = Animations.createFadeTransition(backgroundIcon, JFXConstants.TRANSPARENCY_FULLY, JFXConstants.TRANSPARENCY_NONE, cycleCount, JFXConstants.ANIMATION_DURATION_FADE_SLOW);
        backgroundIconColorFadeAnimation.setOnFinished(event -> backgroundIcon.setOpacity(JFXConstants.TRANSPARENCY_FULLY));
        backgroundIconColorFadeAnimation.play();
    }