public static void paintAboveline(Graphics g, JTextComponent tc, int pos0, int pos1)
      throws BadLocationException {
    g.setColor(Color.GREEN.darker());
    TextUI ui = tc.getUI();
    Rectangle r = ui.modelToView(tc, pos1 + 1);
    int h = r.y;

    int max = r.x - 2 + 1;
    int current = ui.modelToView(tc, pos0).x - 1;
    g.drawLine(current, h, max, h);
    g.drawLine(current, h + 1, current, h + 2);
    g.drawLine(max, h + 1, max, h + 2);
  }
    /**
     * Paints a highlight.
     *
     * @param g the graphics context
     * @param offs0 the starting model offset >= 0
     * @param offs1 the ending model offset >= offs1
     * @param bounds the bounding box for the highlight
     * @param c the editor
     */
    public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
      Rectangle alloc = bounds.getBounds();
      try {
        // --- determine locations ---
        TextUI mapper = c.getUI();
        Rectangle p0 = mapper.modelToView(c, offs0);
        Rectangle p1 = mapper.modelToView(c, offs1);

        // --- render ---
        Color color = getColor();

        if (color == null) {
          g.setColor(c.getSelectionColor());
        } else {
          g.setColor(color);
        }
        if (p0.y == p1.y) {
          // same line, render a rectangle
          Rectangle r = p0.union(p1);
          g.fillRect(r.x, r.y, r.width, r.height);
        } else {
          // different lines
          int p0ToMarginWidth = alloc.x + alloc.width - p0.x;
          g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height);
          if ((p0.y + p0.height) != p1.y) {
            g.fillRect(alloc.x, p0.y + p0.height, alloc.width, p1.y - (p0.y + p0.height));
          }
          g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height);
        }
      } catch (BadLocationException e) {
        // can't render
      }
    }
 /*     */ public void paint(Graphics paramGraphics) /*     */ {
   /* 127 */ if (isVisible())
     /*     */ try {
       /* 129 */ JTextComponent localJTextComponent = getComponent();
       /* 130 */ Color localColor =
           localJTextComponent.hasFocus()
               ? localJTextComponent.getCaretColor()
               : localJTextComponent.getDisabledTextColor();
       /*     */
       /* 132 */ TextUI localTextUI = localJTextComponent.getUI();
       /* 133 */ int i = getDot();
       /* 134 */ Rectangle localRectangle = localTextUI.modelToView(localJTextComponent, i);
       /* 135 */ int j = localRectangle.x - 2;
       /* 136 */ int k = localRectangle.x + 2;
       /* 137 */ int m = localRectangle.y + 1;
       /* 138 */ int n = localRectangle.y + localRectangle.height - 2;
       /* 139 */ paramGraphics.setColor(localColor);
       /* 140 */ paramGraphics.drawLine(localRectangle.x, m, localRectangle.x, n);
       /* 141 */ paramGraphics.drawLine(j, m, k, m);
       /* 142 */ paramGraphics.drawLine(j, n, k, n);
       /*     */ }
     /*     */ catch (BadLocationException localBadLocationException)
     /*     */ {
       /*     */ }
   /*     */ }
  public static void paintUnderline(Graphics g, JTextComponent tc, int pos0, int pos1)
      throws BadLocationException {
    g.setColor(Color.RED);
    TextUI ui = tc.getUI();
    Rectangle r = ui.modelToView(tc, pos1 + 1);
    int h = r.y + r.height - 2;

    int max = r.x - 2;
    int current = ui.modelToView(tc, pos0).x;
    while (current <= max) {
      g.drawLine(current, h, Math.min(current + 2, max), h + 1);
      current += 3;
      if (current <= max) {
        g.drawLine(current, h, Math.min(current + 2, max), h);
        current += 3;
      }
    }
  }