Change focus to next component in JTable using TAB

后端 未结 4 1982
一个人的身影
一个人的身影 2020-12-20 15:35

JTable\'s default behavior is changing focus to next cell and I want to force it to move focus to next component (e.g. JTextField) on TAB key pressed.
I overrided

4条回答
  •  感动是毒
    2020-12-20 16:01

    To reset to the standard keyboard bindings (typically TAB and SHIFT+TAB), simply specify null for the keystrokes parameter to Component.setFocusTraversalKeys:

    table.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
    table.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
    

提交回复
热议问题