In a tool, I'm working on, I have a table, that I add like so:
在一个工具中,我正在研究,我有一个表,我这样添加:
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" });
}
Works well, but now, I'd like to add a JFace table viewer, but the documentation on that seems to concern with TableLayouts only, not Tables. I thought, the TableViewer would be added onto of the table?
运行良好,但现在,我想添加一个JFace表查看器,但是关于它的文档似乎只与TableLayouts有关,而不是表。我想,TableViewer会被添加到表格中吗?
1 个解决方案
#1
0
Figured it out in the meantime. It's just a change in the first to lines, like so:
在此期间想出来了。这只是第一行到行的变化,如下所示:
TableViewer viewer = new TableViewer(this, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table = viewer.getTable();
That way, you can contract the table like before.
这样,您可以像以前一样收缩表。
#1
0
Figured it out in the meantime. It's just a change in the first to lines, like so:
在此期间想出来了。这只是第一行到行的变化,如下所示:
TableViewer viewer = new TableViewer(this, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table = viewer.getTable();
That way, you can contract the table like before.
这样,您可以像以前一样收缩表。