public static void addTextMarkerToPosition(
      OtrosJTextWithRulerScrollPane<? extends JTextComponent> pane,
      int charPosition, final String tooltip, Color color,
      TooltipMode tooltipMode) {

    String tooltipText = tooltip;
    MarkerModel markerModel = pane.getRulerBar().getMarkerModel();
    String text = pane.getjTextComponent().getText();
    int lines = countLines(text);
    int lineOfCharPosition = countLineOfCharPosition(charPosition, text);
    float percentValue = (float) lineOfCharPosition
        / Math.max(lines - 1, 1);
    if (TooltipMode.LINE_NUMBER_PREFIX.equals(tooltipMode)) {
      tooltipText = "Line " + lineOfCharPosition + ": " + tooltipText;
    }
    LineInTextMarker marker = new LineInTextMarker(tooltipText, color,
        percentValue, charPosition, pane.getjTextComponent());
    markerModel.addMarker(marker);
  }
Add Marker at select position
@param pane OtrosJTextWithRulerScrollPane
@param charPosition position
@param tooltip Tooltip message
@param color marker color
@param tooltipMode Tooltip mode
olv-gui/src/main/java/pl/otros/swing/rulerbar/RulerBarHelper.java