In my Jtable
I have a column with boolean
values displayed as Checkbox
. I have added the Jtable
TableCellRenderer
and following is the code :
TableCellRenderer tableCellBoolean = new DefaultTableCellRenderer() {
Boolean UserEnterValuse = new Boolean(false);
public Component getTableCellRendererComponent(JTable table,
Boolean value, boolean isSelected, boolean hasFocus,
int row, int column) {
if (value instanceof Boolean) {
UserEnterValuse = Boolean.valueOf(value.toString());
System.out.print(table.getCellRenderer(row, column));
//InstallmentDate.get
table.setValueAt(UserEnterValuse, row, column);
}
return super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
}
};
I have also added the setCellEditor
but when i click on the Jtable
cell then it show me the Checkbox
and after selecting or changing the values in the cell it shows me true or false depending on selection type, but is does not show me Checkbox
.
If i don't add TableCellRenderer
and also when i set the values to Jtable
cell it gives me error : Object can not cast to Boolean Type
.