code: public void paintIcon (Component c, Graphics g, int x, int y)
      {
          Graphics2D g2 = (Graphics2D) g;
          // turn on anti-aliasing
          Object oldAlias = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
          g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                  RenderingHints.VALUE_ANTIALIAS_ON);
  
          Rectangle bounds = _shape.getBounds();
          int dx = x - bounds.x;
          int dy = y - bounds.y;
          g2.translate(dx, dy);
          if (_fillColor != null) {
              g2.setColor(_fillColor);
              g2.fill(_shape);
          }
          if (_outlineColor != null) {
              g2.setColor(_outlineColor);
              g2.draw(_shape);
          }
          g2.translate(-dx, -dy);
          g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAlias);
      }
docs: documentation inherited from interface Icon