Reputation: 2115
I want to move with TAB key through the form. By default TAB jumping through first line first and then through second and so on. I want it to jump through columns how should I do this? I was trying with keyPressed
event, but didn't worked.
This is code of one jTextField
which request focus of second jTextField
:
if(evt.getKeyCode() == KeyEvent.VK_TAB){
tfPriimek.requestFocus();
}
Thanks!
Upvotes: 0
Views: 79
Reputation: 3884
Focus Subsystem Tutorial has all the information you need. In the Customizing Focus Traversal subchapter you will find information on how to supply your own focus traversal policy, that allows to define what components get focus and in which order.
As for your own approach:
Tab cycles focus. Will you do Shift+Tab as well? How about other focus cycling mechanisms? Best use the system as it's meant to be used.
Upvotes: 1