根据Java文档,JTable中使用的默认编辑器DefaultCellEditor中,只有表的列值类型为Boolean就会自动使用check box的renderer和editor [1],但实际上不行,生成JTable实例后,得重新配置相应列的默认编辑器为JCheckBox,即 [2]:
JTable jtable = new JTable(data, columnNames);
jtable.getColumnModel().getColumn(第n列).setCellEditor(new DefaultCellEditor(new JCheckBox));
自己重写的话,最好连TableModel也自定义,然后再自己写Renderer和Editor。
参考:
[1] https://docs.oracle.com/javase/tutorial/uiswing/components/table.html
[2] http://blog.sina.com.cn/s/blog_6cba238f0101cmrh.html