All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.text.DefaultHighlighter

java.lang.Object
   |
   +----java.awt.Component
           |
           +----com.sun.java.swing.text.DefaultHighlighter

public class DefaultHighlighter
extends Component
implements Highlighter
Implements the Highlighter interface as a lightweight component that can be used as a backdrop to component(s) implementing View.

See Also:
Highlighter

Constructor Index

 o DefaultHighlighter(TextUI)
Creates a new object.

Method Index

 o addHighlight(int, int, Color)
Adds a highlight to the view.
 o changeHighlight(Object, int, int)
Changes a highlight.
 o deinstall(JTextComponent)
Called when the UI is being removed from the interface of a JTextComponent.
 o install(JTextComponent)
Called when the UI is being installed into the interface of a JTextComponent.
 o paint(Graphics)
Renders the highlights.
 o removeAllHighlights()
Removes all highlights.
 o removeHighlight(Object)
Removes a highlight from the view.

Constructors

 o DefaultHighlighter
 public DefaultHighlighter(TextUI mapper)
Creates a new object.

Parameters:
mapper - a reference to the actual text

Methods

 o paint
 public void paint(Graphics g)
Renders the highlights.

Parameters:
g - the graphics context
Overrides:
paint in class Component
 o install
 public void install(JTextComponent c)
Called when the UI is being installed into the interface of a JTextComponent. Installs the document model.

Parameters:
c - the component
See Also:
install
 o deinstall
 public void deinstall(JTextComponent c)
Called when the UI is being removed from the interface of a JTextComponent.

Parameters:
c - the component
See Also:
deinstall
 o addHighlight
 public Object addHighlight(int p0,
                            int p1,
                            Color c) throws BadLocationException
Adds a highlight to the view. Returns a tag that can be used to refer to the highlight.

Parameters:
p0 - the start offset of the range to highlight
p1 - the end offset of the range to highlight
c - color to make the highlight
Returns:
s an object that can be used as a tag to refer to the highlight
Throws: BadLocation
if the specified location is invalid
 o removeHighlight
 public void removeHighlight(Object tag)
Removes a highlight from the view.

Parameters:
tag - the reference to the highlight
 o removeAllHighlights
 public void removeAllHighlights()
Removes all highlights.

 o changeHighlight
 public void changeHighlight(Object tag,
                             int p0,
                             int p1) throws BadLocationException
Changes a highlight.

Parameters:
tag - the highlight tag
p0 - the beginning of the range
p1 - the end of the range
Throws: BadLocation
if the specified location is invalid

All Packages  Class Hierarchy  This Package  Previous  Next  Index