Class RTextAreaHighlighter

  • All Implemented Interfaces:
    UIResource, Highlighter
    Direct Known Subclasses:
    RSyntaxTextAreaHighlighter

    public class RTextAreaHighlighter
    extends BasicTextUI.BasicHighlighter
    The highlighter implementation used by RTextAreas. It knows to always paint "mark all" highlights below selection 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.

    • Field Detail

      • textArea

        protected RTextArea textArea
        The text component we are the highlighter for.
    • Constructor Detail

      • RTextAreaHighlighter

        public RTextAreaHighlighter()
        Constructor.
    • Method Detail

      • getMarkAllHighlightCount

        public int getMarkAllHighlightCount()
        Returns the number of "mark all" highlights currently shown in the editor.
        Returns:
        The "mark all" highlight count.
      • getMarkAllHighlightRanges

        public List<DocumentRange> getMarkAllHighlightRanges()
        Returns a list of "mark all" highlights in the text area. If there are no such highlights, this will be an empty list.
        Returns:
        The list of "mark all" highlight ranges.
      • paintLayeredHighlights

        public void paintLayeredHighlights​(Graphics g,
                                           int lineStart,
                                           int lineEnd,
                                           Shape viewBounds,
                                           JTextComponent editor,
                                           View view)
        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 DefaultHighlighter
        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