开发者

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);

Java SWT CheckedListBox


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜