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
public class SmartHighlightPainter extends ChangeableHighlightPainter
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.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SmartHighlightPainter()
Creates a highlight painter that defaults to blue.SmartHighlightPainter(Paint paint)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getPaintBorder()
Returns whether a border is painted around marked occurrences.Shape
paintLayer(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent c, View view)
Paints a portion of a highlight.void
setPaint(Paint paint)
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
-
-
-
-
Constructor Detail
-
SmartHighlightPainter
public SmartHighlightPainter()
Creates a highlight painter that defaults to blue.
-
SmartHighlightPainter
public SmartHighlightPainter(Paint paint)
Constructor.- Parameters:
paint
- The color or paint to use for this painter.
-
-
Method Detail
-
getPaintBorder
public boolean getPaintBorder()
Returns whether a border is painted around marked occurrences.- Returns:
- Whether a border is painted.
- See Also:
setPaintBorder(boolean)
,ChangeableHighlightPainter.getPaint()
-
paintLayer
public Shape paintLayer(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent c, View view)
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
public void setPaint(Paint paint)
Sets thePaint
(usually ajava.awt.Color
) used to paint this highlight.- Overrides:
setPaint
in classChangeableHighlightPainter
- Parameters:
paint
- The newPaint
.- See Also:
ChangeableHighlightPainter.getPaint()
-
setPaintBorder
public void setPaintBorder(boolean paint)
Toggles whether a border is painted around highlights.- Parameters:
paint
- Whether to paint a border.- See Also:
getPaintBorder()
,setPaint(Paint)
-
-