|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wintertree.ssce.StringWordParser
com.jivesoftware.spark.component.spelling.InputTextParser
This class is based on the Swing example work that Wintertree provides with their spelling package. What they provided was insufficient in that it was written to work with an instance of JTextArea.
Field Summary |
Fields inherited from class com.wintertree.ssce.StringWordParser |
cachedWord, cursor, is1stWord, isHyphenDelimiter, nReplacements, nWords, subWordLength, theString |
Constructor Summary | |
InputTextParser(javax.swing.JTextPane textPane,
boolean isHyphenDelim)
|
Method Summary | |
void |
deleteText(int numChars)
Delete characters from the text starting at the current cursor position. |
int |
deleteWord()
|
void |
highlightWord()
Highlight the current word in the text area. |
void |
insertText(int pos,
java.lang.String newText)
Calls the three argument version of this method with null. |
void |
insertText(int pos,
java.lang.String newText,
javax.swing.text.AttributeSet as)
Insert text at a specified position. |
void |
replaceWord(java.lang.String newWord)
Replace the word at the current position with a new word. |
void |
updateText()
Report that the contents of the TextPane have changed. |
Methods inherited from class com.wintertree.ssce.StringWordParser |
deleteWord, findWordStart, getCursor, getNumReplacements, getNumWords, getPrevWord, getWord, hasMoreElements, includeCharInWord, includeCharInWord, is1stWordChar, isDoubledWord, isFirstWord, isWordChar, nextElement, nextWord, setCursor, setText, setWordLength, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public InputTextParser(javax.swing.JTextPane textPane, boolean isHyphenDelim)
textPane
- The JTextPane component to parse.isHyphenDelim
- true if a hyphen is to be considered a word delimiter, false if it's part of a word.Method Detail |
public void deleteText(int numChars) throws java.util.NoSuchElementException
numChars
- the number of characters to delete.
java.util.NoSuchElementException
- thrown in a delete beyond the end of the string.public int deleteWord()
public void highlightWord()
public void insertText(int pos, java.lang.String newText)
pos
- The position at which new text is to be inserted.newText
- The text to insert.public void insertText(int pos, java.lang.String newText, javax.swing.text.AttributeSet as)
pos
- The position at which new text is to be inserted.newText
- The text to insert.as
- the attribute set to use with the text, if null then it attempts to get the
attribute set at the position of specified by the first argumentpublic void replaceWord(java.lang.String newWord) throws java.util.NoSuchElementException
newWord
- The word to replace the word at the current position.
java.util.NoSuchElementException
- The cursor is positioned at the end
of the string.public void updateText()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |