In java Swing table, how to split a cell into two, one is TextField, another one is a checkbox. I have done some codes, but doesn't work. thanks
public class CustomTableCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int column) {
Component cell = super.getTableCellRendererComponent(table, obj, isSelected, hasFocus, row, column);
JTextField fld = new JTextField();
JCheckBox chx = new JCheckBox();
cell.add(fld); // Doesn't work
cell.add(chx); // Doesn't work
return cell;
}
}