diff --git a/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java b/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java index 0bd682a155..f37e657e23 100644 --- a/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java +++ b/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java @@ -109,12 +109,22 @@ synchronized public void paint(Graphics gfx) { } // draw color boxes + int lastLine = -1; + int extra = 0; for (ColorControlBox cBox: colorBoxes.get(currentTab)) { - int lineStartChar = textArea.getLineStartOffset(cBox.getLine()); - int x = textArea.offsetToX(cBox.getLine(), cBox.getCharIndex() - lineStartChar); + int line = cBox.getLine(); + int lineEndChar = textArea.getLineStopOffset(cBox.getLine()); + if (line == lastLine) { + extra = extra + 30; + } + else { + extra = 0; + } + int x = textArea.offsetToX(cBox.getLine(), lineEndChar); int y = textArea.lineToY(cBox.getLine()) + fm.getDescent(); - cBox.setPos(x, y+1); + cBox.setPos(x + extra, y+1); cBox.draw(g2d); + lastLine = line; } } }