且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从jtable中连续勾选jcheckbox获取值

更新时间:2023-12-03 17:45:04

这是不清楚你得到的错误或你得到的错误;我怀疑错误转换为 Boolean 。作为一般指导,默认渲染器和编辑器 Boolean.class JCheckbox ;你不应该明确地设置它。如此处所示,请确保您遵循以下原则让您的演员阵容成功:

It's not clear what error you get or where you get it; I suspect an error casting to Boolean. As general guidance, the default renderer and editor for Boolean.class is a JCheckbox; you shouldn't have to set it explicitly. As shown here, ensure that you observe the following principles for your cast to succeed:


  • TableModel $ c $中插入 Boolean.class 类型的值c>。

  • Insert values of type Boolean.class in your TableModel.

getColumnClass()返回 Boolean.class 相关列的code>。

Return Boolean.class from getColumnClass() for the relevant column.

isCellEditable()返回所需的值。