0
在一個工具,我的工作,我有一個表,我添加像這樣:添加的JFace的TableViewer到SWT表
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會被添加到表格中?
如果你解決你的問題,你應該接受你的答案:) – Baz