Users (and developers) tend to be imperfect.
In particular, most folks upon occasion miszpell a word or two.
Because of this, integrated spellchecking is one of Mac OS
X's most useful native APIs. Apple also makes
available the Java Spelling Framework, a set of
wrappers for the native spelling libraries included in your Mac OS X
distribution. Like the Speech API and QuickTime, these wrappers are
part of the platform, and no special steps for using spelling are
required beyond an extra download or two.
At its core, the Java Spelling Framework is refreshingly
straightforward. It can be attached directly to a Swing text
component to provide either interactive or real-time spellchecking.
It can handle user interface complexity either automatically, or in a
more programmatic fashion suitable for more sophisticated
applications. It's easy to imagine using the
Spelling API and the Java Servlet API to construct a web-based
spellchecker for user-submitted text. You could aid users in
searches, for example, by suggesting corrected spellings for
misspelled words. You could even use this framework to build a fully
featured GUI word processor. The possibilities are nearly limitless.
This chapter adds interactive and real-time spellcheck functionality
to the SimpleEdit application constructed in Chapter 4 and Chapter 5. This
functionality will give you a feel for the Spelling Framework and
help you understand how it integrates into existing programs.
If you've been browsing but haven't
kept your code up to date with the examples, you'll
need the example code from Chapter 4, along with
the updates detailed in Chapter 5, to build the
sample application in this chapter. You can also download this code
online at the book's web site.