add(separator);
_testField = new TestField("Test Field: ", "");
add(_testField);
_spellCheckItem =
new MenuItem(new StringProvider("Spell check"), 0x230010, 1);
_spellCheckItem.setCommand(new Command(new CommandHandler() {
/**
* Checks the spelling in the TestField.
*
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
if (_testField.getText().length() == 0) {
Dialog.alert("Test field cannot be empty");
} else {
_app.spellCheck(_testField);
}
}
}));
_learnWordItem =
new MenuItem(new StringProvider("Learn word"), 0x230020, 1);
_learnWordItem.setCommand(new Command(new CommandHandler() {
/**
* Learns the word in the TestField.
*
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
if (_testField.getText().length() == 0) {
Dialog.alert("Test field cannot be empty");
} else {
_app.learnWord(_testField.getText());
}
}
}));
_learnCorrectionItem =
new MenuItem(new StringProvider("Learn correction"), 0x230030,
2);
_learnCorrectionItem.setCommand(new Command(new CommandHandler() {
/**
* Shows the user a list of possible corrections for the word in the
* TestField.