如何在选择 JTable 值的同时选择所有单元格?

发布于 2024-08-25 01:21:42 字数 188 浏览 4 评论 0原文

首先,我给出了 JTAble 中行的所有值。在将表值插入数据库时​​,我使用以下

model.getValueAt(rowIndex,colIndex);

选择了 JTable 中行的所有值。但此方法获取一行中除最后插入的列之外的所有列。如果我按下回车键,在获得所有值后它就完成得很好。如何在不按回车键的情况下获取一行中的所有列?

First i gave all values of row in JTAble. While inserting table values into database, I selected all values of row in JTable, using the following

model.getValueAt(rowIndex,colIndex);

But this method gets all the columns except the last inserted column in a row. If i pressed enter key, after getting all values it done well. How to get all columns in a row with out pressed enter key?

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

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

发布评论

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

评论(2

内心激荡 2024-09-01 01:21:42

我建议您获取表模型的内容,而不是访问表中显示的数据。事实上,可能存在用于显示改变内容的格式化程序。此外,表模型反映表中的数据,无论列以何种顺序显示。

I would suggest you to get content of table model, instead of accessing data displayed in the table. Indeed, there may be formatters for displaying content that alter it. Furthermore, the table model reflects the data that is in the table, no matter in which order columns are displayed.

分開簡單 2024-09-01 01:21:42

如果我理解这个问题,那么表格停止编辑将解释问题并给出解决方案。

If I understand the question then Table Stop Editing will explain the problem and give a solution.

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