Package org.fife.ui.rtextarea
Class SmartHighlightPainter
java.lang.Object
javax.swing.text.LayeredHighlighter.LayerPainter
org.fife.ui.rtextarea.ChangeableHighlightPainter
org.fife.ui.rtextarea.SmartHighlightPainter
- All Implemented Interfaces:
Serializable
,Highlighter.HighlightPainter
A "smart" highlight painter designed for use in RSyntaxTextArea. Adds the
following features:
- Rendered highlights don't "grow" when users append text to the "end" of them. This is implemented by assuming that the highlights themselves specify their end offset as one offset "too short". This behavior is baked into various RSTA highlights (mark all, mark occurrences, etc.).
- Ability to paint a border line around highlights.
- Version:
- 1.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a highlight painter using a default color.SmartHighlightPainter
(Paint paint) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether a border is painted around marked occurrences.paintLayer
(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent c, View view) Paints a portion of a highlight.void
Sets thePaint
(usually ajava.awt.Color
) used to paint this highlight.void
setPaintBorder
(boolean paint) Toggles whether a border is painted around highlights.Methods inherited from class org.fife.ui.rtextarea.ChangeableHighlightPainter
getAlpha, getPaint, getRoundedEdges, paint, setAlpha, setRoundedEdges
-
Field Details
-
DEFAULT_HIGHLIGHT_COLOR
The default highlight color. -
borderColor
-
paintBorder
private boolean paintBorder
-
-
Constructor Details
-
SmartHighlightPainter
public SmartHighlightPainter()Creates a highlight painter using a default color. -
SmartHighlightPainter
Constructor.- Parameters:
paint
- The color or paint to use for this painter.
-
-
Method Details
-
getPaintBorder
public boolean getPaintBorder()Returns whether a border is painted around marked occurrences.- Returns:
- Whether a border is painted.
- See Also:
-
paintLayer
Description copied from class:ChangeableHighlightPainter
Paints a portion of a highlight.- Overrides:
paintLayer
in classChangeableHighlightPainter
- Parameters:
g
- the graphics contextp0
- the starting model offset >= 0p1
- the ending model offset >= offs1viewBounds
- the bounding box of the view, which is not necessarily the region to paint.c
- the editorview
- View painting for- Returns:
- region drawing occurred in
-
setPaint
Description copied from class:ChangeableHighlightPainter
Sets thePaint
(usually ajava.awt.Color
) used to paint this highlight.- Overrides:
setPaint
in classChangeableHighlightPainter
- Parameters:
paint
- The newPaint
.- See Also:
-
setPaintBorder
public void setPaintBorder(boolean paint) Toggles whether a border is painted around highlights.- Parameters:
paint
- Whether to paint a border.- See Also:
-