I cannot put jChceckBox to jTable cell. More likely I can put checkBox to table, but when I run module with that table, the cell where should be checkBox shows text “true” or “false”. The behaviors of that cell are the same like checkbox, but it shows text value instead of checkbox.
Here is the code.
DefaultTableModel dm = new DefaultTableModel();
dm.setDataVector(new Object[][]{{"dd", "Edit", "Delete"},
{"dd","Edit", "Delete"}},
new Object[]{"Include","Component", "Ekvi"});
jTable1 = new javax.swing.JTable();
jTable1.setModel(dm);
JCheckBox chBox=new JCheckBox();
jTable1.getColumn("Include").setCellEditor(new DefaultCellEditor(chBox));
jScrollPane1.setViewportView(jTable1);
The cell editor defines how the data inside your table behave according to editing its value, what you need is the right
TableCellRendererto properly display the checkbox inside the cell: