void () { final List<CaretRectangle> caretPoints = new ArrayList<CaretRectangle>(); for (Caret caret : getCaretModel().getAllCarets()) { boolean isRtl = caret.isAtRtlLocation(); VisualPosition caretPosition = caret.getVisualPosition(); Point pos1 = visualPositionToXY(caretPosition); Point pos2 = visualPositionToXY(new VisualPosition(caretPosition.line, Math.max(0, caretPosition.column + (isRtl ? -1 : 1)))); caretPoints.add(new CaretRectangle(pos1, Math.abs(pos2.x - pos1.x), caret, isRtl)); } myCaretCursor.setPositions(caretPoints.toArray(new CaretRectangle[caretPoints.size()])); }