本文介绍了JTable焦点查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JTable中,当按Tab键时,焦点将移至表格的下一个单元格.按下选项卡时,有什么方法可以将焦点向下移动.

In a JTable when a tab 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");

这篇关于JTable焦点查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 23:36