how to put jcheckbox to table cell?

Posted by joseph on Stack Overflow See other posts from Stack Overflow or by joseph
Published on 2010-03-13T20:16:55Z Indexed on 2010/03/13 20:25 UTC
Read the original article Hit count: 275

Filed under:
|

Hello, 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);

© Stack Overflow or respective owner

Related posts about java

Related posts about swing