Hi I am able to render the Boolean column as a JToggleButton but if I keep the button pressed, I am seeing the checkbox instead of the button.
TableColumnModel tcm = smartAlertsTable.getColumnModel();
TableColumn tc = tcm.getColumn( Index of the boolean column);
tc.setCellRenderer(new ActiveAlertRenderer());
where ActiveAlertRenderer is
public class ActiveAlertRenderer extends JToggleButton implements
TableCellRenderer
{
public ActiveAlertRenderer()
{
super();
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
{
boolean isActive = ((Boolean) value).booleanValue();
if (isActive)
{
this.setText("Armed");
this.setSelected(false);
value = Boolean.TRUE;
}
else
{
this.setText("Triggered");
this.setSelected(true);
value = Boolean.FALSE;
}
return this;
}
}
How do I prevent the checkbox from appearing?
Try like this:
}