1.在TableModel中设置列类型

@Override
public Class getColumnClass(int columnIndex) {
    return getValueAt(0, columnIndex).getClass();
}

 

 

2.重写jtable 的isCellEditable方法,否则复选框无法选中

@Override
   public boolean isCellEditable(int arg0, int arg1) {
        return getValueAt(arg0, arg1).getClass() == Boolean.class;
   }

 

相关文章:

  • 2022-03-07
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
猜你喜欢
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-12-30
相关资源
相似解决方案