void (Graphics2D g, Rectangle2D clip) { float lineHeight = getLineHeight(g); HighlightingAttributesIterator hIterator = new HighlightingAttributesIterator(myHighlighter.createIterator(myOffset)); if (hIterator.atEnd()) { myOffset = mySegmentEnd; return; } LineIterator lIterator = myDocument.createLineIterator(); lIterator.start(myOffset); if (lIterator.atEnd()) { myOffset = mySegmentEnd; return; } TextAttributes attributes = hIterator.getTextAttributes(); Color currentColor = attributes.getForegroundColor(); Color backColor = attributes.getBackgroundColor(); Color underscoredColor = attributes.getEffectColor(); Font currentFont = getFont(attributes.getFontType()); setForegroundColor(g, currentColor); setFont(g, currentFont); g.translate(clip.getX(), 0); Point2D position = new Point2D.Double(0, clip.getY()); double lineY = position.getY(); if (myPerformActualDrawing) { getMethodSeparatorColor(lIterator.getLineNumber()); } char[] text = myDocument.getCharsSequence().toString().toCharArray(); while (!hIterator.atEnd() && !lIterator.atEnd()) { int hEnd = hIterator.getEnd(); int lEnd = lIterator.getEnd(); int lStart = lIterator.getStart(); if (hEnd >= lEnd) { if (!drawString(g, text, lEnd - lIterator.getSeparatorLength(), myOffset == lStart, position, clip, backColor, underscoredColor)) { drawLineNumber(g, lineY); break; } drawLineNumber(g, lineY); lIterator.advance(); myLineNumber++; position.setLocation(0, position.getY() + lineHeight); lineY = position.getY(); myOffset = lEnd; if (myPerformActualDrawing) { Color markerColor = getMethodSeparatorColor(lIterator.getLineNumber()); if (markerColor != null) { Color save = g.getColor(); setForegroundColor(g, markerColor); LinePainter2D.paint(g, 0, (int)lineY, (int)clip.getWidth(), (int)lineY); setForegroundColor(g, save); } } if (position.getY() > clip.getY() + clip.getHeight() - lineHeight) { break; } } else { if (hEnd > lEnd - lIterator.getSeparatorLength()) { if (!drawString(g, text, lEnd - lIterator.getSeparatorLength(), myOffset == lStart, position, clip, backColor, underscoredColor)) { drawLineNumber(g, lineY); break; } } else { if (!drawString(g, text, hEnd, myOffset == lStart, position, clip, backColor, underscoredColor)) { drawLineNumber(g, lineY); break; } } hIterator.advance(); attributes = hIterator.getTextAttributes(); Color color = attributes.getForegroundColor(); if (color == null) { color = Color.black; } if (color != currentColor) { setForegroundColor(g, color); currentColor = color; } backColor = attributes.getBackgroundColor(); underscoredColor = attributes.getEffectColor(); Font font = getFont(attributes.getFontType()); if (font != currentFont) { setFont(g, font); currentFont = font; } myOffset = hEnd; } } g.translate(-clip.getX(), 0); }