JTable Focus Query?
In a JTable
when a t开发者_如何学编程ab key is pressed the focus is moved to the next cell of the of the table. Is there any way by which focus is moved down when tab is pressed.
Yes, as shown below. See also How to Use Key Bindings.
table.setCellSelectionEnabled(true);
KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
InputMap map = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
map.put(tab, "selectNextRowCell");
精彩评论