(1)如果是在第一列,則可以使用SWT.CHECK 樣式來實現,例如:
Table table = new Table(parent, SWT.CHECK);
(2)如果不是第一列,則可以使用TableEditor,創建一個Control懸浮在CellEditor之上,例如:
TableEditor editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(button, items[i], 2);
Demo連接:
http://www.java2s.com/Tutorial/Java/0280__SWT/TableCellEditorComboTextandButton.htm