N
Nuggy
I have the following issue, condensed down to this simple example:
Data entry program. Screen contains three JTextFields. I want the
program to automatically jump to the next field when the user presses
"Enter", instead of the user having to press Tab. (We have picky Data
Entry people.)
I am performing validation on these fields when they lose focus, by
means of focusGained and focusLost methods from the implemented
FocusListener class.
I have buttons that I have been able to "trigger" when they have focus
and the user presses the enter key; I do not want to lose this
functionality.
This is how I implemented this for the buttons, but doing the same for
the text fields does not seem to work:
button.registerKeyboardAction(
button.getActionForKeyStroke(
KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)),
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true),
JComponent.WHEN_FOCUSED);
If anyone can let me know how to accomplish this, I'd appreciate it!
TIA,
-Mike
Data entry program. Screen contains three JTextFields. I want the
program to automatically jump to the next field when the user presses
"Enter", instead of the user having to press Tab. (We have picky Data
Entry people.)
I am performing validation on these fields when they lose focus, by
means of focusGained and focusLost methods from the implemented
FocusListener class.
I have buttons that I have been able to "trigger" when they have focus
and the user presses the enter key; I do not want to lose this
functionality.
This is how I implemented this for the buttons, but doing the same for
the text fields does not seem to work:
button.registerKeyboardAction(
button.getActionForKeyStroke(
KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)),
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true),
JComponent.WHEN_FOCUSED);
If anyone can let me know how to accomplish this, I'd appreciate it!
TIA,
-Mike