Sometimes you may need to add SWT controls to the cells of the SWT Table. This can be done by using org.eclipse.swt.custom.TableEditor.

Snapshot of the table having Checkbutton and Combo in its cell is shown below:

Example

Following is the example of adding the SWT CheckBox and SWT Combo into the cells of the table.

Implementation Code

 private void createTable() {

  Table table = new Table(top, SWT.NONE);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setBounds(new org.eclipse.swt.graphics.Rectangle(47,67,190,70));

  TableColumn tableColumn = new TableColumn(table, SWT.NONE);
  tableColumn.setWidth(100);
  tableColumn.setText("Check Column");

  TableColumn tableColumn1 = new TableColumn(table, SWT.NONE);
  tableColumn1.setWidth(100);
  tableColumn1.setText("Combo Column");

  TableItem tableItem=new TableItem(table,SWT.NONE);
  TableEditor editor = new TableEditor (table);

  Button checkButton = new Button(table, SWT.CHECK);
  checkButton.pack();

  editor.minimumWidth = checkButton.getSize ().x;
  editor.horizontalAlignment = SWT.CENTER;
  editor.setEditor(checkButton, tableItem, 0);
  editor = new TableEditor (table);

  Combo combo = new Combo(table, SWT.CHECK);
  combo.pack();

  editor.minimumWidth = combo.getSize ().x;
  editor.horizontalAlignment = SWT.CENTER;
  editor.setEditor(combo, tableItem, 1);

}