Class Proofreader
java.lang.Object
com.codename1.spellcheck.Proofreader
Spelling and grammar checks together, as a DocumentView uses them to underline problems.
Results are remembered per text, so a paragraph is checked again only when it changes.
DocumentModel model = new DocumentModel(new Document());
model.insertBlock(0, new Paragraph(model.newId('p'), RichText.of("Quarterly review")));
Proofreader p = new Proofreader(SpellChecker.forLanguage("en_US"), GrammarChecker.english());
DocumentView view = new DocumentView(model);
view.setProofreader(p);
Form form = new Form("Proofreading", new BorderLayout());
form.add(BorderLayout.CENTER, view);
form.show();
-
Constructor Summary
ConstructorsConstructorDescriptionProofreader(SpellChecker spelling, GrammarChecker grammar) Creates a proofreader; either checker may be null. -
Method Summary
Modifier and TypeMethodDescriptionThe problems in a text, by position, without spelling suggestions.The grammar checker.The spell checker.voidForgets remembered results, after the user dictionary or the rules changed.The problem at a character of a text, with suggestions filled in for a misspelling.
-
Constructor Details
-
Proofreader
Creates a proofreader; either checker may be null.
Parameters
-
spelling: the spell checker, or null -
grammar: the grammar checker, or null
-
-
-
Method Details
-
getSpellChecker
The spell checker.
Returns
the checker, or null
-
getGrammarChecker
The grammar checker.
Returns
the checker, or null
-
check
The problems in a text, by position, without spelling suggestions.
Parameters
text: the text, typically a paragraph
Returns
the issues; do not modify the list
-
issueAt
The problem at a character of a text, with suggestions filled in for a misspelling.
Parameters
-
text: the text -
offset: the character -
max: the most suggestions
Returns
the issue, or null when there is none there
-
-
invalidate
public void invalidate()Forgets remembered results, after the user dictionary or the rules changed.
-