Paint a single icon.
976463
def _paint_icon(self, iconic, painter, rect, mode, state, options):
        """"""
        painter.save()
        color = options['color']
        char = options['char']

        color_options = {
            QIcon.On: {
                QIcon.Normal: (options['color_on'], options['on']),
                QIcon.Disabled: (options['color_on_disabled'],
                                 options['on_disabled']),
                QIcon.Active: (options['color_on_active'],
                               options['on_active']),
                QIcon.Selected: (options['color_on_selected'],
                                 options['on_selected']) 
            },

            QIcon.Off: {
                QIcon.Normal: (options['color_off'], options['off']),
                QIcon.Disabled: (options['color_off_disabled'],
                                 options['off_disabled']),
                QIcon.Active: (options['color_off_active'],
                               options['off_active']),
                QIcon.Selected: (options['color_off_selected'],
                                 options['off_selected']) 
            }
        }

        color, char = color_options[state][mode]

        painter.setPen(QColor(color))

        # A 16 pixel-high icon yields a font size of 14, which is pixel perfect
        # for font-awesome. 16 * 0.875 = 14
        # The reason why the glyph size is smaller than the icon size is to
        # account for font bearing.

        draw_size = 0.875 * round(rect.height() * options['scale_factor'])
        prefix = options['prefix']

        # Animation setup hook
        animation = options.get('animation')
        if animation is not None:
            animation.setup(self, painter, rect)

        painter.setFont(iconic.font(prefix, draw_size))
        if 'offset' in options:
            rect = QRect(rect)
            rect.translate(options['offset'][0] * rect.width(),
                           options['offset'][1] * rect.height())

        painter.setOpacity(options.get('opacity', 1.0))

        painter.drawText(rect, Qt.AlignCenter | Qt.AlignVCenter, char)
        painter.restore()
359306
public void addIcon(Object icon, int iIndex)
    {
        if (m_rgIcons == null)
        {
            m_rgIcons = new ImageIcon[MAX_ICONS];
            m_timer = new javax.swing.Timer(500, this);         // Remind me to change graphics every 1/2 second
            m_timer.start();
        }
        if (iIndex < MAX_ICONS)
        	if (icon instanceof ImageIcon)		// Always
        		m_rgIcons[iIndex] = (ImageIcon)icon;
    }
1129113
@NonNull
    public IconicsDrawable icon(@NonNull Character icon) {
        return iconText(icon.toString(), null);
    }
111000
public synchronized void setIcon(Object icon, int iIconType)
    {
        if (m_rgIcons == null)
            m_rgIcons = new ImageIcon[CalendarConstants.END_ICON - CalendarConstants.START_ICON + 1];
        m_rgIcons[iIconType - CalendarConstants.START_ICON] = icon;   // Always at location 0
    }
431543
private Icon createIcon(SortOrder sortOrder, int sortPriority)
    {
        final Color color = UIManager.getColor("controlDkShadow");
        final int width = 12;
        final int height = 12;
        final int sizeX = Math.max(2, width - sortPriority * 2);
        final int sizeY = Math.max(2, height - sortPriority * 2);
        final int space = (height - sizeY) / 2;
        final Shape shape = 
            sortOrder == SortOrder.ASCENDING ?
                createArrowShape(sizeX, space, height-space) :
                createArrowShape(sizeX, height-space, space);
        return new Icon()
        {
            @Override
            public void paintIcon(Component c, Graphics gr, int x, int y)
            {
                Graphics2D g = (Graphics2D)gr;
                AffineTransform oldAT = g.getTransform();
                g.translate(x,y);
                g.setColor(color);
                g.fill(shape);
                g.setTransform(oldAT);
            }

            @Override
            public int getIconWidth()
            {
                return width;
            }

            @Override
            public int getIconHeight()
            {
                return height;
            }
        };        
    }
1156992
def paintEvent(self, event):
        """"""
        if self.isVisible() and self.position != self.Position.FLOATING:
            # fill background
            self._background_brush = QBrush(QColor(
                self.editor.sideareas_color))
            self._foreground_pen = QPen(QColor(
                self.palette().windowText().color()))
            painter = QPainter(self)
            painter.fillRect(event.rect(), self._background_brush)
291167
public static void iconComponent(Component component, UiIcon icon)
	{
		component.add(AttributeModifier.append("class", "ui-icon " + icon.getCssClass()));
	}
870303
def paintEvent(self, event):
        """"""
        super(FigureCanvas, self).paintEvent(event)
        # Prepare the rect on which the image is going to be painted :
        fw = self.frameWidth()
        rect = QRect(0 + fw, 0 + fw,
                     self.size().width() - 2 * fw,
                     self.size().height() - 2 * fw)

        if self.fig is None or self._blink_flag:
            return

        # Check/update the qpixmap buffer :
        qpix2paint = None
        for qpix in self._qpix_buffer:
            if qpix.size().width() == rect.width():
                qpix2paint = qpix
                break
        else:
            if self.fmt in ['image/png', 'image/jpeg']:
                qpix2paint = self._qpix_orig.scaledToWidth(
                    rect.width(), mode=Qt.SmoothTransformation)
            elif self.fmt == 'image/svg+xml':
                qpix2paint = QPixmap(svg_to_image(self.fig, rect.size()))
            self._qpix_buffer.append(qpix2paint)

        if qpix2paint is not None:
            # Paint the image on the widget :
            qp = QPainter()
            qp.begin(self)
            qp.drawPixmap(rect, qpix2paint)
            qp.end()
176303
def set_icon(self, icon, qtgui_module):
        """"""

        if self._use_fallback:
            icon.addFile(self._fallback)
        else:
            for role, pixmap in self._roles.items():
                if role.endswith("off"):
                    mode = role[:-3]
                    state = qtgui_module.QIcon.Off
                elif role.endswith("on"):
                    mode = role[:-2]
                    state = qtgui_module.QIcon.On
                else:
                    continue

                mode = getattr(qtgui_module.QIcon, mode.title())

                if pixmap:
                    icon.addPixmap(qtgui_module.QPixmap(pixmap), mode, state)
                else:
                    icon.addPixmap(qtgui_module.QPixmap(), mode, state)

        self.icon = icon
586241
private  void initialize(ImageIcon icon) {
        this.setLayout(new CardLayout());
        if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
        	this.setSize(474, 251);
        }
        this.setName(Constant.messages.getString(prefix + ".panel.title"));
		this.setIcon(icon);
        this.add(getPanelCommand(), prefix + ".panel");
        scanStatus = new ScanStatus(icon, Constant.messages.getString(prefix + ".panel.title"));
        
        if (View.isInitialised()) {
        	View.getSingleton().getMainFrame().getMainFooterPanel().addFooterToolbarRightLabel(scanStatus.getCountLabel());
        }
	}
1298102
private void paintMinimizePressed(Graphics2D g, JComponent c, int width, int height) {
        iconifyPainter.paintPressed(g, c, width, height);
    }
523989
def draw_icon(point, icon)
      x, y = point.pixel(@bounding_box)
      icon.draw(@canvas, x, y)
    end
715361
def icon(cls, size):
        """"""
        tile = pygame.Surface((size, size))
        tile.fill((237, 194, 46))
        label = load_font(cls.BOLD_NAME, int(size / 3.2)).render(cls.NAME, True, (249, 246, 242))
        width, height = label.get_size()
        tile.blit(label, ((size - width) / 2, (size - height) / 2))
        return tile
94395
def setHoverIcon(self, icon):
        
        icon = QIcon(icon)
        if not icon.isNull():
            self._hoverIcon = QIcon(icon)
        else:
            self._hoverIcon = None
155936
def paint(self, painter, option, index):
        """"""
        component = index.model().data(index, role=QtCore.Qt.UserRole)
        painter.drawRect(option.rect)

        component.paint(painter, option.rect, option.palette)
515625
public function icon($icon, $is_icon_only = true)
    {
        $this->setIcon($icon);
        ($is_icon_only) ? $this->enableIconOnly() : $this->disableIconOnly();
        return $this;
    }
988782
def paint( self, painter, option, index ):
        
        # draw the background
        edit = self.parent()
        item = edit.item(index.row())
        if ( not isinstance(item, XMultiTagCreateItem) ):
            if ( item.isSelected() ):
                painter.setBrush(edit.highlightColor())
            else:
                painter.setBrush(edit.tagColor())
            
            painter.drawRect(option.rect)
        
        painter.setBrush(Qt.NoBrush)
        painter.setPen(item.foreground().color())
        
        super(XMultiTagDelegate, self).paint(painter, option, index)
        
        # draw the border
        item = self.parent().item(index.row())
        if ( not isinstance(item, XMultiTagCreateItem) ):
            painter.setPen(edit.borderColor())
            painter.setBrush(Qt.NoBrush)
            painter.drawRect(option.rect)
            painter.drawText(option.rect.right() - 14,
                             option.rect.top() + 1,
                             16,
                             16,
                             Qt.AlignCenter,
                             'x')