// Paint icons
if (trackingIcons!=null) {
int lastLine = textArea.getLineCount() - 1;
for (int i=trackingIcons.size()-1; i>=0; i--) { // Last to first
GutterIconInfo ti = getTrackingIcon(i);
Icon icon = ti.getIcon();
if (icon!=null) {
int iconH = icon.getIconHeight();
int offs = ti.getMarkedOffset();
if (offs>=0 && offs<=doc.getLength()) {
int line = root.getElementIndex(offs);
if (line<=lastLine && line>=topLine) {
try {
int lineY = rsta.yForLine(line);
if (lineY<=bottomY && (lineY+iconH>=topY)) {
int y2 = lineY + (cellHeight-iconH)/2;
ti.getIcon().paintIcon(this, g, 0, y2);
lastLine = line-1; // Paint only 1 icon per line
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Never happens
}