在一个工具中,我正在研究,我有一个表,我添加如下:
public void addTable() {
table = new Table(this, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
griddata = new GridData(GridData.FILL_BOTH);
griddata.horizontalSpan = 2;
table.setLayoutData(griddata);
table.setHeaderVisible(true);
final TableColumn tc1 = new TableColumn(table, SWT.LEFT);
final TableColumn tc2 = new TableColumn(table, SWT.CENTER);
final TableColumn tc3 = new TableColumn(table, SWT.CENTER);
tc1.setText("ID");
tc2.setText("Firstname");
tc3.setText("Lastname");
tc1.setWidth(30);
tc2.setWidth(100);
tc3.setWidth(100);
final TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText(new String[] { "ABC", "Hatton", "Kentucky" });
final TableItem item2 = new TableItem(table, SWT.NONE);
item2.setText(new String[] { "DEF", "Warner", "Ohio" });
}
效果很好,但是现在,我想添加一个 JFace 表格查看器,但是关于它的文档似乎只涉及 TableLayouts,而不涉及表格。我想,TableViewer 会被添加到桌子上吗?