java swing,模拟JTable终止EditOnFocusLost行为

发布于 2024-10-09 21:38:12 字数 348 浏览 0 评论 0原文

putClientProperty("terminateEditOnFocusLost", Boolean);

当 jtable 失去焦点或简单地单击其他 GUI 组件时,它会结束编辑并清除当前选定的行。 这非常有用,但是对于“terminateEditOnFocusLost”,如果将其与 editCellAt 和 changeSelection 一起使用,则会出现一些奇怪的行为。

还有一些不良的 TableModelEvents 因一些虚假的表更新而被触发。

所以,我正在寻找一种黑客来模拟“terminateEditOnFocusLost”而不使用它,这可能吗?

谢谢大家。

putClientProperty("terminateEditOnFocusLost", Boolean);

to make jtable end editing and clear current selected rows when it lose focus or when simply click over an other GUI component.
This is very useful, but with "terminateEditOnFocusLost" there are some strange behaviours if it is used with editCellAt and changeSelection.

There are also some undesiderable TableModelEvents fired for some fake table updates.

So, im looking for an hack to simulate "terminateEditOnFocusLost without using it, is this possibile?

Thanks all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迎风吟唱 2024-10-16 21:38:12

目前没有黑客攻击。
putClientProperty("terminateEditOnFocusLost", Boolean) 似乎是唯一正确的方法。

No hack at this moment.
putClientProperty("terminateEditOnFocusLost", Boolean) seem to be the only correct way.

过期以后 2024-10-16 21:38:12

重载该函数以使其满足您的需求。

Overload the function to make it suit your needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文