org.fife.ui.rsyntaxtextarea

## Class RSyntaxTextAreaHighlighter

- java.lang.Object
- - javax.swing.text.LayeredHighlighter
  - - javax.swing.text.DefaultHighlighter
    - - javax.swing.plaf.basic.BasicTextUI.BasicHighlighter
      - - org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaHighlighter

All Implemented Interfaces:
  UIResource, Highlighter

    public class RSyntaxTextAreaHighlighter
    extends BasicTextUI.BasicHighlighter

The highlighter implementation used by `RSyntaxTextArea`s. 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.

Version:
  1.0
Author:
  Robert Futrell

### Nested Class Summary

Nested Classes
`static interface` `RSyntaxTextAreaHighlighter.HighlightInfo`

### Nested classes/interfaces inherited from class javax.swing.text.DefaultHighlighter

`DefaultHighlighter.DefaultHighlightPainter`

### Nested classes/interfaces inherited from class javax.swing.text.LayeredHighlighter

`LayeredHighlighter.LayerPainter`

### Nested classes/interfaces inherited from interface javax.swing.text.Highlighter

`Highlighter.Highlight, Highlighter.HighlightPainter`

### Field Summary

### Fields inherited from class javax.swing.text.DefaultHighlighter

`DefaultPainter`

### Constructor Summary

Constructors
Constructor and Description
`RSyntaxTextAreaHighlighter()` Constructor.

### Method Summary

Methods
`void` `clearParserHighlights(Parser parser)` Removes all of the highlights for a specific parser.
`void` `deinstall(JTextComponent c)`
`List<DocumentRange>` `getMarkedOccurrences()` Returns a list of "marked occurrences" in the text area.
`void` `install(JTextComponent c)`
`void` `paint(Graphics g)` Renders the highlights.
`void` `paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view)` When leaf Views (such as LabelView) are rendering they should call into this method.

### Methods inherited from class javax.swing.text.DefaultHighlighter

`addHighlight, changeHighlight, getDrawsLayeredHighlights, getHighlights, removeAllHighlights, removeHighlight, setDrawsLayeredHighlights`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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.

#### deinstall

    public void deinstall(JTextComponent c)

Specified by:
  `deinstall` in interface `Highlighter`
Overrides:
  `deinstall` in class `DefaultHighlighter`

#### 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`.

#### install

    public void install(JTextComponent c)

Specified by:
  `install` in interface `Highlighter`
Overrides:
  `install` in class `DefaultHighlighter`

#### paint

    public void paint(Graphics g)

Renders the highlights.

Specified by:
  `paint` in interface `Highlighter`
Overrides:
  `paint` in class `DefaultHighlighter`
Parameters:
  `g` - the graphics context

#### paintLayeredHighlights

    public void paintLayeredHighlights(Graphics g,
                              int p0,
                              int p1,
                              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
  `p0` - starting offset of view
  `p1` - ending offset of view
  `viewBounds` - Bounds of View
  `editor` - JTextComponent
  `view` - View instance being rendered