Allowing Multiple-Row Selection

The Table default is to allow only one row to be selected at a time. This is equivalent to a setting of SWT.SINGLE . To allow more than one row to be selected, you must use the SWT.MULTI style.

How do I do that?

To allow for multiple selection of rows, add SWT.MULTI to the styles list passed to the Table constructor:

Table t = new Table(s, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);

The result of this change is shown in Figure 12-4, when the user has selected more than one row.

Multiple-selection table

Figure 12-4. Multiple-selection table

Get SWT: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.