删除 jtable 中通过箭头键进行的行选择
我在 JScrollpane 中实现了 JTable。我已将 MouseListener 添加到 JTable,因此它可以与 MouseListener 一起正常工作。
现在我的问题是,行选择也通过键盘箭头键(向上箭头/向下箭头)进行更改,并且它不会调用我已经使用 MouseListener 实现的方法。所以我只想通过键盘箭头删除 JTable 选择。
请帮助我。
I have implemented a JTable in JScrollpane. I have added MouseListener to the JTable, so its working fine with MouseListener.
Now my problem is, the row selection changes by the Keyboard Arrow keys(up arrow/down arrow) also and it does not call the methods that I have already implemented with MouseListener. So i just want to remove the JTable selection by Keyboard arrows.
Kindly help me.
Swing 组件使用 按键绑定 在给定 KeyStoke 时调用 Action进入。
通过阅读上面的教程链接,您应该能够使用以下代码删除键绑定:
我将让您处理向上键。
Swing components use Key Bindings to invoke Action when a give KeyStoke is entered.
From reading the above tutorial link you should be able to remove the key bindings by using code like:
I'll let you handle the up key.