org.brains2b.thex.gui
Class PseudoHighlighter

java.lang.Object
  extended by javax.swing.text.LayeredHighlighter
      extended by org.brains2b.thex.gui.PseudoHighlighter
All Implemented Interfaces:
javax.swing.text.Highlighter

public class PseudoHighlighter
extends javax.swing.text.LayeredHighlighter

Implementation of Highlighter to correctly highlight hex-spaced characters

Version:
$Revision: 1.2 $ $Date: 2010/01/15 03:53:05 $
Author:
dennis@brains2b.nl

Nested Class Summary
static class PseudoHighlighter.BinaryHighlight
          Highlight that defines the start, end of a selected area.
 
Nested classes/interfaces inherited from class javax.swing.text.LayeredHighlighter
javax.swing.text.LayeredHighlighter.LayerPainter
 
Nested classes/interfaces inherited from interface javax.swing.text.Highlighter
javax.swing.text.Highlighter.Highlight, javax.swing.text.Highlighter.HighlightPainter
 
Constructor Summary
PseudoHighlighter()
          Constructor Create a PseudoHighlighter where alwaysPaint is false
PseudoHighlighter(boolean alwaysPaint)
          Constructor
 
Method Summary
 java.lang.Object addHighlight(int p0, int p1, javax.swing.text.Highlighter.HighlightPainter p)
          (
 void changeHighlight(java.lang.Object tag, int p0, int p1)
          
 void deinstall(javax.swing.text.JTextComponent c)
          
 javax.swing.text.Highlighter.Highlight findHighlight(int dot, javax.swing.text.Position.Bias b)
          find the first Highlight from the dot in the given direction
 javax.swing.text.Highlighter.Highlight[] getHighlights()
          
 void install(javax.swing.text.JTextComponent c)
          
 boolean isActive()
          return if this PseudoHighlighter is painting
 void paint(java.awt.Graphics g)
          Not implemented use paintLayeredHighlights(Graphics, int, int, Shape, JTextComponent, View)
 void paintLayeredHighlights(java.awt.Graphics g, int p0, int p1, java.awt.Shape viewBounds, javax.swing.text.JTextComponent editor, javax.swing.text.View view)
          
 void removeAllHighlights()
          
 void removeHighlight(java.lang.Object tag)
          
 PseudoHighlighter shareHighlighter()
          creates a Highlighter that shares the properties and segments of this highLighter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PseudoHighlighter

public PseudoHighlighter()
Constructor Create a PseudoHighlighter where alwaysPaint is false

See Also:
PseudoHighlighter(boolean)

PseudoHighlighter

public PseudoHighlighter(boolean alwaysPaint)
Constructor

Parameters:
alwaysPaint - boolean if true paint the highlights even when the editor has focus
Method Detail

paintLayeredHighlights

public void paintLayeredHighlights(java.awt.Graphics g,
                                   int p0,
                                   int p1,
                                   java.awt.Shape viewBounds,
                                   javax.swing.text.JTextComponent editor,
                                   javax.swing.text.View view)

Specified by:
paintLayeredHighlights in class javax.swing.text.LayeredHighlighter

addHighlight

public java.lang.Object addHighlight(int p0,
                                     int p1,
                                     javax.swing.text.Highlighter.HighlightPainter p)
                              throws javax.swing.text.BadLocationException
(

Throws:
javax.swing.text.BadLocationException

changeHighlight

public void changeHighlight(java.lang.Object tag,
                            int p0,
                            int p1)
                     throws javax.swing.text.BadLocationException

Throws:
javax.swing.text.BadLocationException

deinstall

public void deinstall(javax.swing.text.JTextComponent c)


getHighlights

public javax.swing.text.Highlighter.Highlight[] getHighlights()


install

public void install(javax.swing.text.JTextComponent c)


paint

public void paint(java.awt.Graphics g)
Not implemented use paintLayeredHighlights(Graphics, int, int, Shape, JTextComponent, View)


removeAllHighlights

public void removeAllHighlights()


removeHighlight

public void removeHighlight(java.lang.Object tag)


shareHighlighter

public PseudoHighlighter shareHighlighter()
creates a Highlighter that shares the properties and segments of this highLighter

Returns:
PseudoHighlighter

findHighlight

public javax.swing.text.Highlighter.Highlight findHighlight(int dot,
                                                            javax.swing.text.Position.Bias b)
find the first Highlight from the dot in the given direction

Parameters:
dot - int, the position to look from
b - Bias, the direction to look into for the next PseudoHighlighter.BinaryHighlight
Returns:
Highlight

isActive

public boolean isActive()
return if this PseudoHighlighter is painting

Returns:
boolean true if this PseudoHighlighter is painting which means the editor has no focus or alwaysPaint is true