Chapter 11. The Mac OS X Spelling Framework
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. ...
Get Mac OS X for Java Geeks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.