Package org.fife.ui.rtextarea
Class LineHighlightManager
- java.lang.Object
-
- org.fife.ui.rtextarea.LineHighlightManager
-
class LineHighlightManager extends java.lang.Object
Manages line highlights in anRTextArea
.- Version:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LineHighlightManager.LineHighlightInfo
Information about a line highlight.private static class
LineHighlightManager.LineHighlightInfoComparator
Comparator used when adding new highlights.
-
Field Summary
Fields Modifier and Type Field Description private LineHighlightManager.LineHighlightInfoComparator
comparator
private java.util.List<LineHighlightManager.LineHighlightInfo>
lineHighlights
private RTextArea
textArea
-
Constructor Summary
Constructors Constructor Description LineHighlightManager(RTextArea textArea)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
addLineHighlight(int line, java.awt.Color color)
Highlights the specified line.protected java.util.List<java.lang.Object>
getCurrentLineHighlightTags()
Returns the current line highlights' tags.protected int
getLineHighlightCount()
Returns the current number of line highlights.void
paintLineHighlights(java.awt.Graphics g)
Paints any highlighted lines in the specified line range.void
removeAllLineHighlights()
Removes all line highlights.void
removeLineHighlight(java.lang.Object tag)
Removes a line highlight.private void
repaintLine(LineHighlightManager.LineHighlightInfo lhi)
Repaints the line pointed to by the specified highlight information.
-
-
-
Field Detail
-
textArea
private RTextArea textArea
-
lineHighlights
private java.util.List<LineHighlightManager.LineHighlightInfo> lineHighlights
-
comparator
private LineHighlightManager.LineHighlightInfoComparator comparator
-
-
Constructor Detail
-
LineHighlightManager
LineHighlightManager(RTextArea textArea)
Constructor.- Parameters:
textArea
- The parent text area.
-
-
Method Detail
-
addLineHighlight
public java.lang.Object addLineHighlight(int line, java.awt.Color color) throws javax.swing.text.BadLocationException
Highlights the specified line.- Parameters:
line
- The line to highlight.color
- The color to highlight with.- Returns:
- A tag for the highlight.
- Throws:
javax.swing.text.BadLocationException
- Ifline
is not a valid line number.- See Also:
removeLineHighlight(Object)
-
getCurrentLineHighlightTags
protected java.util.List<java.lang.Object> getCurrentLineHighlightTags()
Returns the current line highlights' tags.- Returns:
- The current line highlights' tags, or an empty list if there are none.
-
getLineHighlightCount
protected int getLineHighlightCount()
Returns the current number of line highlights. Useful for testing.- Returns:
- The current number of line highlights.
-
paintLineHighlights
public void paintLineHighlights(java.awt.Graphics g)
Paints any highlighted lines in the specified line range.- Parameters:
g
- The graphics context.
-
removeAllLineHighlights
public void removeAllLineHighlights()
Removes all line highlights.- See Also:
removeLineHighlight(Object)
-
removeLineHighlight
public void removeLineHighlight(java.lang.Object tag)
Removes a line highlight.- Parameters:
tag
- The tag of the line highlight to remove.- See Also:
addLineHighlight(int, Color)
-
repaintLine
private void repaintLine(LineHighlightManager.LineHighlightInfo lhi)
Repaints the line pointed to by the specified highlight information.- Parameters:
lhi
- The highlight information.
-
-