lib
Class CurrentLineHighlighter

java.lang.Object
  extended by lib.CurrentLineHighlighter

public class CurrentLineHighlighter
extends java.lang.Object

This class can be used to highlight the current line for any JTextComponent.

Version:
1.0
Author:
Santhosh Kumar T, Peter De Bruycker

Field Summary
private static javax.swing.event.CaretListener caretListener
           
private static java.awt.Color col
           
private static java.lang.String LINE_HIGHLIGHT
           
private static java.awt.event.MouseListener mouseListener
           
private static java.awt.event.MouseMotionListener mouseMotionListener
           
private static javax.swing.text.Highlighter.HighlightPainter painter
           
private static java.lang.String PREVIOUS_CARET
           
 
Constructor Summary
CurrentLineHighlighter()
           
 
Method Summary
private static void caretUpdate(javax.swing.text.JTextComponent c)
          Fetches the previous caret location, stores the current caret location, If the caret is on another line, repaint the previous line and the current line
static void install(javax.swing.text.JTextComponent c)
           
static void uninstall(javax.swing.text.JTextComponent c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_HIGHLIGHT

private static final java.lang.String LINE_HIGHLIGHT
See Also:
Constant Field Values

PREVIOUS_CARET

private static final java.lang.String PREVIOUS_CARET
See Also:
Constant Field Values

col

private static java.awt.Color col

caretListener

private static javax.swing.event.CaretListener caretListener

mouseListener

private static java.awt.event.MouseListener mouseListener

mouseMotionListener

private static java.awt.event.MouseMotionListener mouseMotionListener

painter

private static javax.swing.text.Highlighter.HighlightPainter painter
Constructor Detail

CurrentLineHighlighter

public CurrentLineHighlighter()
Method Detail

install

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

uninstall

public static void uninstall(javax.swing.text.JTextComponent c)

caretUpdate

private static void caretUpdate(javax.swing.text.JTextComponent c)
Fetches the previous caret location, stores the current caret location, If the caret is on another line, repaint the previous line and the current line

Parameters:
c - the text component