[英]JTable with JComboBox navigation and selection using keyboard only
I'd like to navigate on JTable using only a keyboard, and select values from JComboBox cells also only with a keyboard.我想仅使用键盘在 JTable 上导航,而 JComboBox 单元格中的 select 值也仅使用键盘。
I'm using Oracle Java JTable tutorial, the code is here: https://docs.oracle.com/javase/tutorial/uiswing/examples/components/TableRenderDemoProject/src/components/TableRenderDemo.java我正在使用 Oracle Java JTable 教程,代码在这里:https://docs.oracle.com/javase/tutorial/uiswing/examples/components/TableRenderDemoProject/src24Demo89.components/TableRenderDemoProject/src13588.6
My question is how to select items from combo box when navigating only with the keyboard, for example:我的问题是仅使用键盘导航时如何从组合框中获取 select 项,例如:
How to achieve this functionality?如何实现这个功能?
After more googling I found what I think I needed, here is a link to thread and example from oracle.com oracle.com经过更多谷歌搜索后,我找到了我认为我需要的东西,这里是线程和示例的链接,来自 oracle.com oracle.com
Basically a custom ComboBoxEditor which extends DefaultCellEditor solves the issues.基本上,扩展 DefaultCellEditor 的自定义 ComboBoxEditor 解决了这些问题。 Looks like the default one has several bugs.
看起来默认的有几个错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.