public class DefaultHighlighter extends LayeredHighlighter
Highlighter
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultHighlighter
Simple highlight painter that fills a highlighted area with a solid color.
|
LayeredHighlighter.LayerPainter Highlighter.Highlight , Highlighter.HighlightPainter | Modifier and Type | Field and Description |
|---|---|
static LayeredHighlighter |
DefaultPainter
Default implementation of LayeredHighlighter.LayerPainter that can be used for painting highlights.
|
| Constructor and Description |
|---|
DefaultHighlighter()
Creates a new DefaultHighlighther object.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
addHighlight(int p0, int p1, Highlighter
Adds a highlight to the view.
|
void |
changeHighlight(Object
Changes a highlight.
|
void |
deinstall(JTextComponent
Called when the UI is being removed from the interface of a JTextComponent.
|
boolean |
getDrawsLayeredHighlights()
|
Highlighter |
getHighlights()
Makes a copy of the highlights.
|
void |
install(JTextComponent
Called when the UI is being installed into the interface of a JTextComponent.
|
void |
paint(Graphics
Renders the highlights.
|
void |
paintLayeredHighlights(Graphics
When leaf Views (such as LabelView) are rendering they should call into this method.
|
void |
removeAllHighlights()
Removes all highlights.
|
void |
removeHighlight(Object
Removes a highlight from the view.
|
void |
setDrawsLayeredHighlights(boolean newValue)
If true, highlights are drawn as the Views draw the text.
|
public static final LayeredHighlighter.LayerPainter DefaultPainter
As of 1.4 this field is final.
public DefaultHighlighter()
public void paint(Graphicsg)
g - the graphics context
public void install(JTextComponentc)
c - the editor component
Highlighter.install(javax.swing.text.JTextComponent)
public void deinstall(JTextComponentc)
c - the component
Highlighter.deinstall(javax.swing.text.JTextComponent)
public ObjectaddHighlight(int p0, int p1, Highlighter .HighlightPainter p) throws BadLocationException
p0 - the start offset of the range to highlight >= 0
p1 - the end offset of the range to highlight >= p0
p - the painter to use to actually render the highlight
BadLocationException - if the specified location is invalid
public void removeHighlight(Objecttag)
tag - the reference to the highlight
public void removeAllHighlights()
public void changeHighlight(Objecttag, int p0, int p1) throws BadLocationException
tag - the highlight tag
p0 - the beginning of the range >= 0
p1 - the end of the range >= p0
BadLocationException - if the specified location is invalid
public Highlighter.Highlight [] getHighlights()
Highlighter.getHighlights()
public void paintLayeredHighlights(Graphicsg, int p0, int p1, Shape viewBounds, JTextComponent editor, View view)
paintLayeredHighlights in class
LayeredHighlighter
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
public void setDrawsLayeredHighlights(boolean newValue)
paintLayeredHighlight which will result in a rectangle being drawn before the text is drawn (if the offsets are in a highlighted region that is). For this to work the painter supplied must be an instance of LayeredHighlightPainter.
public boolean getDrawsLayeredHighlights()