RapidSpell Desktop


com.keyoti.rapidSpell.desktop
Class TextBoxUtilityAdapter

java.lang.Object
  |
  +--com.keyoti.rapidSpell.desktop.TextBoxUtilityAdapter

public class TextBoxUtilityAdapter
extends java.lang.Object
implements javax.swing.event.DocumentListener, java.awt.event.MouseListener, java.beans.PropertyChangeListener

Facilitates painting on any JTextComponent and tracks changes This class can be derived from for custom painting of other text boxes.


Field Summary
protected  java.lang.String currentText
           
protected  java.lang.String oldText
           
protected  javax.swing.text.JTextComponent textBox
           
protected  java.util.ArrayList underlines
           
 
Constructor Summary
TextBoxUtilityAdapter(javax.swing.text.JTextComponent t)
           
 
Method Summary
 void addDocumentListener(javax.swing.event.DocumentListener l)
           
 void changedUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that an attribute or set of attributes changed.
protected  WavyUnderlinePainter getNewWavyUnderlinePainter()
          Returns a new instance of WavyUnderlinePainter (or a subclass) used to paint the underlines.
protected  int[] IdentifyChange()
          Returns the start and end indices in the current text of the changed text.
 void insertUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that there was an insert into the document.
 int LastRightClickChar()
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
protected  void OnTextChanged()
          Called when the text box's text is changed
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Called when property changes are made in the text box.
 void removeAllUnderlines()
           
 void removeDocumentListener(javax.swing.event.DocumentListener l)
           
 void RemoveUnderline(int underlineIndex)
           
 void RemoveUnderline(int start, int end, int u, java.awt.Color c)
          Remove underline text, from start index to end index.
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 void Underline(int start, int end, int u, java.awt.Color c)
          Underline text, from start index to end index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textBox

protected javax.swing.text.JTextComponent textBox

currentText

protected java.lang.String currentText

oldText

protected java.lang.String oldText

underlines

protected java.util.ArrayList underlines
Constructor Detail

TextBoxUtilityAdapter

public TextBoxUtilityAdapter(javax.swing.text.JTextComponent t)
Method Detail

LastRightClickChar

public int LastRightClickChar()

getNewWavyUnderlinePainter

protected WavyUnderlinePainter getNewWavyUnderlinePainter()
Returns a new instance of WavyUnderlinePainter (or a subclass) used to paint the underlines. This can easily be overridden to return a custom painter that subclasses WavyUnderlinePainter.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Called when property changes are made in the text box.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

addDocumentListener

public void addDocumentListener(javax.swing.event.DocumentListener l)

removeDocumentListener

public void removeDocumentListener(javax.swing.event.DocumentListener l)

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Gives notification that an attribute or set of attributes changed.
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Gives notification that there was an insert into the document.
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

Underline

public void Underline(int start,
                      int end,
                      int u,
                      java.awt.Color c)
Underline text, from start index to end index.

RemoveUnderline

public void RemoveUnderline(int start,
                            int end,
                            int u,
                            java.awt.Color c)
Remove underline text, from start index to end index.

RemoveUnderline

public void RemoveUnderline(int underlineIndex)

removeAllUnderlines

public void removeAllUnderlines()

OnTextChanged

protected void OnTextChanged()
Called when the text box's text is changed

IdentifyChange

protected int[] IdentifyChange()
Returns the start and end indices in the current text of the changed text.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

RapidSpell Desktop


Copyright © 2002-2005 Keyoti Inc. All Rights Reserved.