Class RSyntaxTextAreaHighlighter

  • All Implemented Interfaces:
    UIResource, Highlighter

    public class RSyntaxTextAreaHighlighter
    extends RTextAreaHighlighter
    The highlighter implementation used by RSyntaxTextAreas. It knows to always paint "marked occurrences" highlights below selection highlights, and squiggle underline highlights above all other highlights.

    Most of this code is copied from javax.swing.text.DefaultHighlighter; unfortunately, we cannot re-use much of it since it is package private.

    • Constructor Detail

      • RSyntaxTextAreaHighlighter

        public RSyntaxTextAreaHighlighter()
        Constructor.
    • Method Detail

      • clearParserHighlights

        public void clearParserHighlights​(Parser parser)
        Removes all of the highlights for a specific parser.
        Parameters:
        parser - The parser.
      • getMarkedOccurrences

        public List<DocumentRange> getMarkedOccurrences()
        Returns a list of "marked occurrences" in the text area. If there are no marked occurrences, this will be an empty list.
        Returns:
        The list of marked occurrences, or an empty list if none. The contents of this list will be of type DocumentRange.
      • paintLayeredHighlights

        public void paintLayeredHighlights​(Graphics g,
                                           int lineStart,
                                           int lineEnd,
                                           Shape viewBounds,
                                           JTextComponent editor,
                                           View view)
        Description copied from class: RTextAreaHighlighter
        When leaf Views (such as LabelView) are rendering they should call into this method. If a highlight is in the given region it will be drawn immediately.
        Overrides:
        paintLayeredHighlights in class RTextAreaHighlighter
        Parameters:
        g - Graphics used to draw
        lineStart - starting offset of view
        lineEnd - ending offset of view
        viewBounds - Bounds of View
        editor - JTextComponent
        view - View instance being rendered