I want to create a table using SWT, and want to add a column with checkbox, then I want to delete the rows which were checked (the checkboxes were checked).
I know how to add a column with checkbox, like following:
TableEditor editor = new TableEditor(table);
final Button checkButton = new Button(table, SWT.CHECK);
but I don’t know how to get the selected rows (the checkbox were checked). I researched it using google, but haven’t found a demo, can anybody tell me how to get the selected rows?
First of all, create your table with the
SWT.CHECKflag, so you don’t need to create Buttons.Second, when you do this, you can use TableItem’s
getChecked()method to retrive the check state.