*/
  @Override
  public void paintComponent(Graphics g) {
    Object map = Toolkit.getDefaultToolkit().getDesktopProperty(
        "awt.font.desktophints"); //$NON-NLS-1$
    if (map != null) {
      ((Graphics2D) g).addRenderingHints((Map<?, ?>) map);
    }

    Rectangle clip = g.getClipBounds();

    // Fill background
    g.setColor(getBackground());
    g.fillRect(clip.x, clip.y, clip.width, clip.height);

    for (Highlighter a : highlighters) {
      a.paint(g, getInsets(), metrics, 0, code.size());
    }

    // Draw each line
    final int insetY = lineLeading + lineAscent;
    int lineNum = clip.y / lineHeight;

    for (int ty = lineNum * lineHeight + insetY; ty < clip.y + clip.height + lineHeight
        && lineNum < code.size(); ty += lineHeight) {
      drawLine(g, lineNum++, ty);
    }

    if (isFocusOwner()) {
      caret.paint(g, sel);
    }
  }