开发者

JTable Focus Query?

开发者 https://www.devze.com 2023-03-31 04:21 出处:网络
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.

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

精彩评论

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

关注公众号