Java SWT CheckedListBox
I could not find CheckedL开发者_如何学编程istBox in Java SWT. Please, point me to a way of extending List
to support checkboxes.
Just add SWT.CHECK to your TableViewer:
new TableViewer(container, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
I think you can try to use table instead of list. Look at this snippet
Use JFace CheckboxTableViewer:
CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(
parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
i've added a button selectAll on the above snippet and added the following event
Table table = new Table(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
Button selectAll= new Button(parent, SWT.PUSH);
selectAll.setFont(FontUtils.getMsSansSerifFont());
selectAll.setLayoutData(gridData);
selectAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
table.selectAll();
}
});
But the checkboxes are not selected?
精彩评论