本文整理汇总了Java中org.eclipse.swt.widgets.Table.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java Table.addListener方法的具体用法?Java Table.addListener怎么用?Java Table.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Table
的用法示例。
在下文中一共展示了Table.addListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.getShell().setText("ViewData Execution History");
container.setLayout(new GridLayout(1, false));
Composite composite1 = new Composite(container, SWT.BORDER);
GridData gd_scrolledComposite1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_scrolledComposite1.heightHint = 236;
gd_scrolledComposite1.widthHint = 844;
composite1.setLayoutData(gd_scrolledComposite1);
table = new Table(composite1, SWT.BORDER | SWT.Selection | SWT.FULL_SELECTION );
table.setBounds(0, 0, 842, 234);
table.setHeaderVisible(true);
table.setLinesVisible(true);
for (int i = 0; i < titles.length; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setWidth(212);
column.setText(titles[i]);
}
jobDetails.sort((job1, job2)-> job2.getUniqueJobID().compareTo(job1.getUniqueJobID()));
for(JobDetails job : jobDetails){
String timeStamp = getTimeStamp(job.getUniqueJobID());
TableItem items = new TableItem(table, SWT.None);
items.setText(0, job.getUniqueJobID());
items.setText(1, timeStamp);
String mode = getJobExecutionMode(job.isRemote());
items.setText(2, mode);
items.setText(3, job.getJobStatus());
}
table.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
TableItem[] item = table.getSelection();
for (int i = 0; i < item.length; i++){
TableItem selectedItem = item[i];
selectedUniqueJobId = selectedItem.getText();
}
}
});
return super.createDialogArea(parent);
}