简体   繁体   English

JTable:更改JCheckBox的状态

[英]JTable: change the status of a JCheckBox

I've a JTable and a column contains Boolean object, so its view in the table is a JCheckBox. 我有一个JTable,一列包含布尔对象,因此它在表中的视图是JCheckBox。 I would like to change the status of the JCheckBox in order to change the data in my model. 我想更改JCheckBox的状态,以便更改模型中的数据。 I set 我设置

@Override
public boolean isCellEditable(int i, int y) {
   return true;
}

but it doesn't work. 但这不起作用。 Could anyone help me? 有人可以帮我吗?

If you look at TableModel, you'll notice the method setValueAt (...). 如果查看TableModel,您会注意到setValueAt (...)方法。 When you click the checkbox in the table, this is where this change will propogate. 单击表中的复选框时,将在此位置进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM