Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SWT表格增量选择_Java_Swt - Fatal编程技术网

Java SWT表格增量选择

Java SWT表格增量选择,java,swt,Java,Swt,我正在使用swt表,并实现了一个selectionListener: table.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { //... } }); 我点击第一个项目,监听器工作 现在,按下按钮后,我想自动选择表中的下一项。我试过: table.setFocus(); table.sele

我正在使用swt表,并实现了一个
selectionListener

table.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent event) {
       //...
    }
});
我点击第一个项目,监听器工作

现在,按下按钮后,我想自动选择表中的下一项。我试过:

table.setFocus();
table.select(table.getSelectionIndex() + 1);

选择更改(蓝色),但selectionListener没有反应

也许你能帮我解决这个问题

谢谢你的帮助

问候

这是出于设计(参见)

您可以执行以下操作:

table.setSelection(1);
table.notifyListeners(SWT.Selection, new Event());

甚至这个:

table.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent event) {
       methodCallHere();
    }
});
然后

table.setSelection(1);
methodCallHere();
table.setSelection(1);
methodCallHere();