Groovy Documentation

com.wordpress.tipsforjava.swing.text
[Java] Class ProtectedHighlighter.ProtectedHighlightPainter

java.lang.Object
  javax.swing.text.LayeredHighlighter.LayerPainter
      javax.swing.text.DefaultHighlighter.DefaultHighlightPainter
          com.wordpress.tipsforjava.swing.text.ProtectedHighlighter.ProtectedHighlightPainter

class ProtectedHighlighter.ProtectedHighlightPainter
extends DefaultHighlighter.DefaultHighlightPainter

Custom painter. Has two main functions: a) make sure only the protected text is highlighted. This means use the start/length information, not the start/end offset informatin b) highlight entire lines (even when text doesn't go to the end) as required.


Field Summary
private JTextComponent component

private int lastLine

 
Constructor Summary
ProtectedHighlighter.ProtectedHighlightPainter(JTextComponent component, Color color)

 
Method Summary
private int getOffs1(int offs0, int offs1)

void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c)

 
Methods inherited from class DefaultHighlighter.DefaultHighlightPainter
paint, getColor, paintLayer, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 
Methods inherited from class LayeredHighlighter.LayerPainter
paintLayer, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll, paint
 

Field Detail

component

private JTextComponent component


lastLine

private int lastLine


 
Constructor Detail

ProtectedHighlighter.ProtectedHighlightPainter

public ProtectedHighlighter.ProtectedHighlightPainter(JTextComponent component, Color color)


 
Method Detail

getOffs1

private int getOffs1(int offs0, int offs1)


paint

public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c)


 

Groovy Documentation