class EditorCurrentLineHighlighter implements CaretListener {

  private static final String me = "EditorCurrentLineHighlighter: ";
  static final Color DEFAULT_COLOR = new Color(230, 230, 210);
  private final Highlighter.HighlightPainter painter;
  private Object highlight = null;

  public EditorCurrentLineHighlighter(JTextPane textPane) {
    this(textPane, null);
  }

  public EditorCurrentLineHighlighter(JTextPane textPane, Color highlightColor) {
    Color c = highlightColor != null ? highlightColor : DEFAULT_COLOR;
    MyHighlighter h = new MyHighlighter();
    textPane.setHighlighter(h);
    painter = new DefaultHighlighter.DefaultHighlightPainter(c);
  }

  @Override
  public void caretUpdate(CaretEvent evt) {<FILL_FUNCTION_BODY>}

  private void removeLineHighlight(JTextComponent comp) {
    if (highlight != null) {
      comp.getHighlighter().removeHighlight(highlight);
      highlight = null;
    }
  }
}

    JTextComponent comp = (JTextComponent) evt.getSource();
    if (comp != null) {
      if (comp.getSelectionStart() != comp.getSelectionEnd()) {
        // cancel line highlighting if selection exists
        removeLineHighlight(comp);
        comp.repaint();
        return;
      }
      int pos = comp.getCaretPosition();
      Element elem = Utilities.getParagraphElement(comp, pos);
      int start = elem.getStartOffset();
      int end = elem.getEndOffset();
      Document doc = comp.getDocument();
      Element root = doc.getDefaultRootElement();
      int line = root.getElementIndex(pos);
      Debug.log(5, "LineHighlight: Caret at " + pos + " line " + line + " for " + start + "-" + end);
      if (SikulixIDE.getStatusbar() != null) {
        SikulixIDE.getStatusbar().setCaretPosition(line + 1, pos - start + 1);
      }
      removeLineHighlight(comp);
      try {
        highlight = comp.getHighlighter().addHighlight(start, end, painter);
        comp.repaint();
      } catch (BadLocationException ex) {
        Debug.error(me + "Problem while highlighting line %d\n%s", pos, ex.getMessage());
      }
    }
  
<no_super_class>