views:

209

answers:

2

I have a small Java application that has a JTextArea where the user enters text. I would like to add spell checking capabilities to this component similar to the way that Microsoft Word does it, i.e. misspelled words are underlined and a popup menu with corrections is displayed when the user right clicks on the underlined word. Are there any open source libraries for adding this functionality to JTextAreas?

+1  A: 

I haven't tried this before, but I came across it a little while ago: http://sourceforge.net/projects/jazzy/

Aidos
+1  A: 

You could implement your own spell checker using a dictionary (can get quite large depending on languages you support), then distance metrics are calculated from the words in the text box to the dictionary. Underlining can be done using font styling, there as applet based sample here.

Jaspell is a Java implementation of the popular Aspell. In there are some explantions of the search algorithms used.

As mentioned previously Jazzy is also great and IBM provides a nice tutorial.

whatnick