org.jdesktop.swingx.plaf
Class PromptTextUI.PainterHighlighter

java.lang.Object
  extended by org.jdesktop.swingx.plaf.PromptTextUI.PainterHighlighter
All Implemented Interfaces:
Highlighter
Enclosing class:
PromptTextUI

protected class PromptTextUI.PainterHighlighter
extends Object
implements Highlighter


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.swing.text.Highlighter
Highlighter.Highlight, Highlighter.HighlightPainter
 
Constructor Summary
PromptTextUI.PainterHighlighter(Painter painter)
           
 
Method Summary
 Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p)
          Adds a highlight to the view.
 void changeHighlight(Object tag, int p0, int p1)
          Changes the given highlight to span a different portion of the document.
 void deinstall(JTextComponent c)
          Called when the UI is being removed from the interface of a JTextComponent.
 Highlighter.Highlight[] getHighlights()
          Fetches the current list of highlights.
 void install(JTextComponent c)
          Called when the UI is being installed into the interface of a JTextComponent.
 void paint(Graphics g)
          Renders the highlights.
 void removeAllHighlights()
          Removes all highlights this highlighter is responsible for.
 void removeHighlight(Object tag)
          Removes a highlight from the view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PromptTextUI.PainterHighlighter

public PromptTextUI.PainterHighlighter(Painter painter)
Method Detail

addHighlight

public Object addHighlight(int p0,
                           int p1,
                           Highlighter.HighlightPainter p)
                    throws BadLocationException
Adds a highlight to the view. Returns a tag that can be used to refer to the highlight.

Specified by:
addHighlight in interface Highlighter
Parameters:
p0 - the beginning of the range >= 0
p1 - the end of the range >= p0
p - the painter to use for the actual highlighting
Returns:
an object that refers to the highlight
Throws:
BadLocationException - for an invalid range specification

changeHighlight

public void changeHighlight(Object tag,
                            int p0,
                            int p1)
                     throws BadLocationException
Changes the given highlight to span a different portion of the document. This may be more efficient than a remove/add when a selection is expanding/shrinking (such as a sweep with a mouse) by damaging only what changed.

Specified by:
changeHighlight in interface Highlighter
Parameters:
tag - which highlight to change
p0 - the beginning of the range >= 0
p1 - the end of the range >= p0
Throws:
BadLocationException - for an invalid range specification

deinstall

public void deinstall(JTextComponent c)
Called when the UI is being removed from the interface of a JTextComponent. This is used to unregister any listeners that were attached.

Specified by:
deinstall in interface Highlighter
Parameters:
c - the JTextComponent editor

getHighlights

public Highlighter.Highlight[] getHighlights()
Fetches the current list of highlights.

Specified by:
getHighlights in interface Highlighter
Returns:
the highlight list

install

public void install(JTextComponent c)
Called when the UI is being installed into the interface of a JTextComponent. This can be used to gain access to the model that is being navigated by the implementation of this interface.

Specified by:
install in interface Highlighter
Parameters:
c - the JTextComponent editor

paint

public void paint(Graphics g)
Renders the highlights.

Specified by:
paint in interface Highlighter
Parameters:
g - the graphics context.

removeAllHighlights

public void removeAllHighlights()
Removes all highlights this highlighter is responsible for.

Specified by:
removeAllHighlights in interface Highlighter

removeHighlight

public void removeHighlight(Object tag)
Removes a highlight from the view.

Specified by:
removeHighlight in interface Highlighter
Parameters:
tag - which highlight to remove