Class RTextAreaHighlighter
java.lang.Object
javax.swing.text.LayeredHighlighter
javax.swing.text.DefaultHighlighter
javax.swing.plaf.basic.BasicTextUI.BasicHighlighter
org.fife.ui.rtextarea.RTextAreaHighlighter
- All Implemented Interfaces:
UIResource, Highlighter
- Direct Known Subclasses:
RSyntaxTextAreaHighlighter
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.
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInformation about a highlight being painted by this highlighter.protected static classA straightforward implementation ofHighlightInfo.static interfaceInformation about a layered highlight being painted by this highlighter.protected static classA straightforward implementation ofHighlightInfofor painting layered highlights.Nested classes/interfaces inherited from class DefaultHighlighter
DefaultHighlighter.DefaultHighlightPainterNested classes/interfaces inherited from class LayeredHighlighter
LayeredHighlighter.LayerPainterNested classes/interfaces inherited from interface Highlighter
Highlighter.Highlight, Highlighter.HighlightPainter -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<RTextAreaHighlighter.HighlightInfo> The "mark all" highlights (to be painted separately from other highlights).protected RTextAreaThe text component we are the highlighter for.Fields inherited from class DefaultHighlighter
DefaultPainter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) ObjectaddMarkAllHighlight(int start, int end, Highlighter.HighlightPainter p) Adds a special "marked occurrence" highlight.(package private) voidRemoves all "mark all" highlights from the view.voidintReturns the number of "mark all" highlights currently shown in the editor.Returns a list of "mark all" highlights in the text area.voidvoidpaintLayeredHighlights(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.protected voidpaintListLayered(Graphics g, int lineStart, int lineEnd, Shape viewBounds, JTextComponent editor, View view, List<? extends RTextAreaHighlighter.HighlightInfo> highlights) protected voidMethods inherited from class DefaultHighlighter
addHighlight, changeHighlight, getDrawsLayeredHighlights, getHighlights, paint, removeAllHighlights, removeHighlight, setDrawsLayeredHighlights
-
Field Details
-
textArea
The text component we are the highlighter for. -
markAllHighlights
The "mark all" highlights (to be painted separately from other highlights).
-
-
Constructor Details
-
RTextAreaHighlighter
public RTextAreaHighlighter()Constructor.
-
-
Method Details
-
addMarkAllHighlight
Object addMarkAllHighlight(int start, int end, Highlighter.HighlightPainter p) throws BadLocationException Adds a special "marked occurrence" highlight.- Parameters:
start- The start offset of the highlight.end- The end offset of the highlight.p- The highlight painter.- Returns:
- A tag to reference the highlight later.
- Throws:
BadLocationException- If one of the offsets specified is invalid.- See Also:
-
clearMarkAllHighlights
void clearMarkAllHighlights()Removes all "mark all" highlights from the view.- See Also:
-
deinstall
- Specified by:
deinstallin interfaceHighlighter- Overrides:
deinstallin classDefaultHighlighter
-
getMarkAllHighlightCount
public int getMarkAllHighlightCount()Returns the number of "mark all" highlights currently shown in the editor.- Returns:
- The "mark all" highlight count.
-
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.
-
install
- Specified by:
installin interfaceHighlighter- Overrides:
installin classDefaultHighlighter
-
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:
paintLayeredHighlightsin classDefaultHighlighter- Parameters:
g- Graphics used to drawlineStart- starting offset of viewlineEnd- ending offset of viewviewBounds- Bounds of Vieweditor- JTextComponentview- View instance being rendered
-
paintListLayered
protected void paintListLayered(Graphics g, int lineStart, int lineEnd, Shape viewBounds, JTextComponent editor, View view, List<? extends RTextAreaHighlighter.HighlightInfo> highlights) -
repaintListHighlight
-