org.fife.rtext
Class SpellingSupport

java.lang.Object
  extended byorg.fife.rtext.SpellingSupport
All Implemented Interfaces:
java.util.EventListener, SpellingParserListener

public class SpellingSupport
extends java.lang.Object
implements SpellingParserListener

Handles spell checking options in RText.

Version:
1.0
Author:
Robert Futrell

Field Summary
static java.lang.String[] DICTIONARIES
          Dictionaries for the supported languages.
 
Constructor Summary
SpellingSupport(RText rtext)
          Constructor.
 
Method Summary
 void forceSpellCheck(RTextEditorPane textArea)
          Forces a spell check to be done in the text area.
 int getMaxSpellingErrors()
          Returns the maximum number of spelling errors to report for a file.
 java.awt.Color getSpellCheckingColor()
          Sets the color to use when squiggle underlining spelling errors.
 java.lang.String getSpellingDictionary()
          Returns the spelling dictionary to use.
 java.io.File getUserDictionary()
          Returns the file used to store words the user chooses to "add to the dictionary."
 boolean isSpellCheckingEnabled()
          Returns whether spell checking is enabled.
 void setMaxSpellingErrors(int max)
          Changes the maximum number of spelling errors reported for a file.
 void setSpellCheckingColor(java.awt.Color color)
          Toggles the color used for squiggle underlining spelling errors.
 void setSpellCheckingEnabled(boolean enabled)
          Toggles whether spell checking is enabled.
 void setSpellingDictionary(java.lang.String dict)
          Sets the spelling dictionary to use.
 void setUserDictionary(java.io.File dict)
          Sets the dictionary that "added words" are added to.
 void spellingParserEvent(SpellingParserEvent e)
          Called when the user adds a word to their user dictionary, or chooses to ignore a word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DICTIONARIES

public static final java.lang.String[] DICTIONARIES
Dictionaries for the supported languages.

Constructor Detail

SpellingSupport

public SpellingSupport(RText rtext)
Constructor.

Parameters:
rtext - The parent application.
Method Detail

forceSpellCheck

public void forceSpellCheck(RTextEditorPane textArea)
Forces a spell check to be done in the text area.

Parameters:
textArea - The text area.

getMaxSpellingErrors

public int getMaxSpellingErrors()
Returns the maximum number of spelling errors to report for a file.

Returns:
The maximum number of spelling errors.
See Also:
setMaxSpellingErrors(int)

getSpellCheckingColor

public java.awt.Color getSpellCheckingColor()
Sets the color to use when squiggle underlining spelling errors.

Returns:
The color to use.
See Also:
setSpellCheckingColor(Color)

getSpellingDictionary

public java.lang.String getSpellingDictionary()
Returns the spelling dictionary to use.

Returns:
The spelling dictionary.
See Also:
setSpellingDictionary(String)

getUserDictionary

public java.io.File getUserDictionary()
Returns the file used to store words the user chooses to "add to the dictionary."

Returns:
The user dictionary file, or null if there is none.
See Also:
setUserDictionary(File)

isSpellCheckingEnabled

public boolean isSpellCheckingEnabled()
Returns whether spell checking is enabled.

Returns:
Whether spell checking is enabled.
See Also:
setSpellCheckingEnabled(boolean)

setMaxSpellingErrors

public void setMaxSpellingErrors(int max)
Changes the maximum number of spelling errors reported for a file.

Parameters:
max - The maximum number of spelling errors.
See Also:
getMaxSpellingErrors()

setSpellCheckingColor

public void setSpellCheckingColor(java.awt.Color color)
Toggles the color used for squiggle underlining spelling errors.

Parameters:
color - The new color to use.
See Also:
getSpellCheckingColor()

setSpellCheckingEnabled

public void setSpellCheckingEnabled(boolean enabled)
Toggles whether spell checking is enabled.

Parameters:
enabled - Whether spell checking is enabled.
See Also:
isSpellCheckingEnabled()

setSpellingDictionary

public void setSpellingDictionary(java.lang.String dict)
Sets the spelling dictionary to use.

Parameters:
dict - The dictionary. If this is unknown, American English is used.
See Also:
getSpellingDictionary()

setUserDictionary

public void setUserDictionary(java.io.File dict)
Sets the dictionary that "added words" are added to.

Parameters:
dict - The new user dictionary. If this is null, then there will be no user dictionary.
See Also:
getUserDictionary()

spellingParserEvent

public void spellingParserEvent(SpellingParserEvent e)
Called when the user adds a word to their user dictionary, or chooses to ignore a word.

Specified by:
spellingParserEvent in interface SpellingParserListener
Parameters:
e - The event.