开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜