Вы можете 1) добавить Action Listener
информирующий вас о ключевом событии. Реализовать Handler Interface
:
// Have the unmodified Enter key cause an event
Action action_ok = new ShortcutAction("Default key", ShortcutAction.KeyCode.ENTER, null);
Action[] actions = new Action[] {action_ok};
public Action[] getActions(Object target, Object sender) {
if (sender == myPanel)
return actions;
return null;
}
/**
* Handle actions received from keyboard. This simply directs
* the actions to the same listener methods that are called
* with ButtonClick events.
*/
public void handleAction(Action action, Object sender, Object target) {
if (action == action_ok) {
okHandler();
}
}
Вы можете добавить обработчик действий к Panel
или Window
// Set this object as the action handler
panel.addActionHandler(this);
Для всей информации имеют вид here особенно под 11.5.2 фокусирования Shortcuts.
2) Но я рекомендую использовать Converter дополнительную информацию here под 9.2.3.
1. Какое действие должно инициировать форматирование? 2. Где вы хотите поместить форматированные значения? – rpozarickij