Sets the icon for this {@link UIImage}.

@param icon the icon
@return this UIImage
170799
public UIImage setIcon(GuiIcon icon)
	{
		this.itemStack = null;
		this.icon = icon;
		setForeground(ICON_RENDER);
		return this;
	}
1172530
public void setIcon(final Image IMAGE) {
        if (null == icon) {
            _icon = IMAGE;
        } else {
            icon.set(IMAGE);
        }
    }
637446
public function setIcon(?string $icon): self
    {
        if (null === $icon) {
            $this->icon = $this->iconType = null;

            return $this;
        }

        if (':' === \mb_substr($icon, 0, 1) && ':' === \mb_substr($icon, \mb_strlen($icon) - 1, 1)) {
            $this->iconType = self::ICON_TYPE_EMOJI;
        } else {
            $this->iconType = self::ICON_TYPE_URL;
        }

        $this->icon = $icon;

        return $this;
    }
967892
public Icon getIcon (String iconSet, int index)
    {
        try {
            // see if the tileset is already loaded
            TileSet set = _icons.get(iconSet);

            // load it up if not
            if (set == null) {
                String path = _config.getProperty(iconSet + PATH_SUFFIX);
                if (StringUtil.isBlank(path)) {
                    throw new Exception("No path specified for icon set");
                }

                String metstr = _config.getProperty(iconSet + METRICS_SUFFIX);
                if (StringUtil.isBlank(metstr)) {
                    throw new Exception("No metrics specified for icon set");
                }

                int[] metrics = StringUtil.parseIntArray(metstr);
                if (metrics == null || metrics.length != 2) {
                    throw new Exception("Invalid icon set metrics " +
                                        "[metrics=" + metstr + "]");
                }

                // load up the tileset
                if (_rsrcSet == null) {
                    set = _tilemgr.loadTileSet(
                        path, metrics[0], metrics[1]);
                } else {
                    set = _tilemgr.loadTileSet(
                        _rsrcSet, path, metrics[0], metrics[1]);
                }

                // cache it
                _icons.put(iconSet, set);
            }

            // fetch the appropriate image and create an image icon
            return new TileIcon(set.getTile(index));

        } catch (Exception e) {
            log.warning("Unable to load icon [iconSet=" + iconSet +
                        ", index=" + index + ", error=" + e + "].");
        }

        // return an error icon
        return new ImageIcon(ImageUtil.createErrorImage(32, 32));
    }
1055789
public function icon($icon = null)
    {
        if (null !== $icon) {
            $this->icon = $icon;

            return $this;
        }

        return $this->icon;
    }
291167
public static void iconComponent(Component component, UiIcon icon)
	{
		component.add(AttributeModifier.append("class", "ui-icon " + icon.getCssClass()));
	}
1229201
public void setIcon(Icon icon) {

        if (icon == null) {
            m_iconContainer.clear();
            this.m_icon = null;
        } else {
            m_iconContainer.getElement().appendChild(icon.getElement());
            this.m_icon = icon;
        }
    }
496092
public static ImageIcon newImageIcon(File image)
	{
		ImageIcon img = new ImageIcon(image.getAbsolutePath());
		return img;
	}
389419
@Override
    public ImageIcon getImageIconResource( final String       key,
                                           final ImageIcon    defaultValue )
        throws
            UtilException
    {
        String    imagePath = getFormattedPropValue( key );

        if ( imagePath == null )
        {
            return defaultValue;
        }

        return resourceToImageIcon( imagePath );
    }
913469
public static BufferedImage createIcon(IconRow icon, float scale,
			IconCache iconCache) {

		BufferedImage iconImage = null;

		if (icon != null) {

			if (iconCache != null) {
				iconImage = iconCache.get(icon.getId());
			}

			if (iconImage == null) {

				try {
					iconImage = icon.getDataImage();
				} catch (IOException e) {
					throw new GeoPackageException(
							"Failed to get the Icon Row image. Id: "
									+ icon.getId() + ", Name: "
									+ icon.getName(), e);
				}

				int dataWidth = iconImage.getWidth();
				int dataHeight = iconImage.getHeight();

				Double iconWidth = icon.getWidth();
				Double iconHeight = icon.getHeight();

				boolean scaleImage = iconWidth != null || iconHeight != null;

				if (!scaleImage && scale != 1.0f) {
					iconWidth = (double) dataWidth;
					iconHeight = (double) dataHeight;
					scaleImage = true;
				}

				if (scaleImage) {

					if (iconWidth == null) {
						iconWidth = dataWidth * (iconHeight / dataHeight);
					} else if (iconHeight == null) {
						iconHeight = dataHeight * (iconWidth / dataWidth);
					}

					int scaledWidth = Math
							.round(scale * iconWidth.floatValue());
					int scaledHeight = Math.round(scale
							* iconHeight.floatValue());

					if (scaledWidth != dataWidth || scaledHeight != dataHeight) {

						Image scaledImage = iconImage.getScaledInstance(
								scaledWidth, scaledHeight, Image.SCALE_SMOOTH);
						iconImage = new BufferedImage(scaledWidth,
								scaledHeight, BufferedImage.TYPE_INT_ARGB);

						Graphics2D graphics = iconImage.createGraphics();
						graphics.drawImage(scaledImage, 0, 0, null);
						graphics.dispose();

					}

				}

				if (iconCache != null) {
					iconCache.put(icon.getId(), iconImage);
				}
			}

		}

		return iconImage;
	}
1155955
public final void setDialogIcon(@Nullable final Bitmap dialogIcon) {
        this.dialogIcon = new BitmapDrawable(getContext().getResources(), dialogIcon);
        this.dialogIconBitmap = dialogIcon;
        this.dialogIconId = -1;
    }
87579
public ServerBuilder setIcon(InputStream icon, String fileType) {
        delegate.setIcon(icon, fileType);
        return this;
    }
67660
protected function setIcon($icon)
    {
        if (is_string($icon) === false) {
            throw new \InvalidArgumentException(
                'The icon label must be a string.'
            );
        }

        $this->icon = $icon;

        return $this;
    }
984881
def set_icon(self, icon):
        ''''''
        self._icon = icon
        return self._listitem.setIconImage(icon)
97990
public void setFontAwesomeIcon(@FontAwesome.Icon CharSequence iconCode) {
        setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addFontAwesomeIcon(iconCode).build());
    }
1254331
public static ImageIcon getScaledInstance(ImageIcon icon, int targetWidth, int targetHeight) {
		return new ImageIcon(getScaledInstance(icon.getImage(), targetWidth, targetHeight));
	}
638500
public ServerBuilder setIcon(BufferedImage icon, String fileType) {
        delegate.setIcon(icon, fileType);
        return this;
    }