NTSpellCheck highlights misspelled words as you type them.
Instructions when using NetBeans IDE 6.0 or above:
1)Download and save NTSpellCheck.jar from Downloads
2)Right click on the project
... [More]
which will use NTSpellCheck
3)Click on Properties
4)Click on Libraries (located to the left of the dialog)
5)Click on the Compile tab, then click the Add JAR/Folder button
6)Navigate to the location where you saved NTSpellCheck.jar and double-click it
7)In your source file, add the following import:
import NTSpellCheck.NTSpellCheck
8)When you need to spell check a JTextComponent, create an instance of NTSpellCheck with the following constructor (Note that it throws an IOException):
NTSpellCheck(JTextComponent tc, File dictionaryFile, boolean checkSpelling, boolean manageRightClicks, int delay, Color highlightColor)
Where:
JTextComponent tc is the JTextComponent to be Spell-Checked;
File dictionaryFile is the file containing the dictionary(included)(words should be separated by newlines);
boolean checkSpelling specifies whether it should begin checking the spelling automatically;
boolean manageRightClicks specifies whether it should manage the right-click pop-up menu
for the JTextComponent;
int delay specifies the delay, in milliseconds, to wait after a key is pressed before
re-checking the spelling(recommended - 100), and
Color highlightColor is the highlight color(recommended - Color.orange)
IMPORTANT- When using Swing dialog boxes like JFileChooser, etc, use the toggleSpellCheck() method to stop spell checking! If you don't, there will be significant
performance degrades in the Swing class. When done using the dialog box, use the same
method to restart the spell checker.
NOTE - You can use setHighlightColor(Color newColor) and setHighlightDelay(int newDelay)
to reset the highlight color and delay respectively. You can download the example if you
need one. [Less]