当与JTable中的JComboBox交互时,如何保持JComboBox的焦点?

时间:2011-11-01 13:07:15

标签: java swing focus jtable jcombobox

当组合框嵌入到JTable中时,使用JComboBox键盘处理行为会发生变化。

E.g。 JComboBox的值为[Item 1,Item 2,Item 3]:

独立行为:您可以多次按“i”来查看所有值。

嵌入式行为:按“i”一次后,comboxbox直接失去焦点,JComboBox值列表崩溃

从我可以收集的内容中,JTable增加了额外的关键处理,并以某种方式获得了焦点,尽管JComboBox应该保留它。

如何防止JTable获得焦点?

1 个答案:

答案 0 :(得分:1)

Embedded behavoir: the comboxbox looses focus directly after pressing "i" once 
and the combobox value list collapses

我认为您必须查看JTable's tutorial,因为example from tutorial抵制键盘问题(如您所述)