Java:在jtable中打破焦点循环 [英] Java: break focus cycle in jtable

查看:169
本文介绍了Java:在jtable中打破焦点循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我实现了ENTER,停止编辑单元格并将焦点传递给下一个单元格。但是,当我在最后一个单元格中按ENTER时,焦点周期使我跳到第一个单元格。但是我想继续在表外设置焦点到一个JButton。

我怎么能打破这个循环?

不是电子表格,而是 setCellSelectionEnabled() 应该允许你继续。根据需要使用 setDefaultButton(),以便示例


$ b

附录:除了 setDefaultButton()之外,还可以在自定义的 Action ,如此处所示。


In my JTable, I want to edit all relevant cells like in Excel.

I implemented that ENTER stops editing the cell and transfers focus to the next cell. However, when I hit ENTER in the last cell, the focus cycle makes me jump to the fist cell. But I want to continue outside the table and set focus to a JButton.

How can I break this cycle?

解决方案

JTable is not a spreadsheet, but setCellSelectionEnabled() should allow you to proceed. Use setDefaultButton() as required, for example.

Addendum: In addition to setDefaultButton(), you can evoke any desired action in your custom Action, as shown here.

这篇关于Java:在jtable中打破焦点循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆