您好,我有以下 swt 表代码
private Table folderAssociationTable;
private TableItem item;
private TableEditor editor;
folderAssociationTable = componentsRenderer.createTableWidget(container, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION, 2, true);
folderAssociationTable.addListener(SWT.MeasureItem, new Listener() {
public void handleEvent(Event event) {
event.height = 20;
}
});
componentsRenderer.createTableColumWidget(folderAssociationTable, SWT.CHECK, "Item", 80);
// add a column to display source folders
componentsRenderer.createTableColumWidget(folderAssociationTable,
SWT.LEFT, PropertyClass.getPropertyLabel(QTLConstants.SOURCE_FOLDER_COLUMN_LABEL), 200);
// add a column to display target folders
componentsRenderer.createTableColumWidget(folderAssociationTable,
SWT.LEFT, PropertyClass.getPropertyLabel(QTLConstants.TARGET_FOLDER_COLUMN_LABEL), 200);
然后以这种方式添加表数据
item = new TableItem(folderAssociationTable, SWT.NONE);
editor = new TableEditor (folderAssociationTable);
Button button = new Button(folderAssociationTable, SWT.CHECK);
button.setText("item "+ (i+1));
button.pack();
editor.minimumWidth = button.getSize ().x;
editor.setEditor(button, item, 0);
item.setText(1, folderlist[i]); // add source folder to the first column of the table
item.setText(2, targetFolderPath); // add target folder to the second column of the table
sourceTargetFolderMap.put(folderlist[i], targetFolderPath);
我在表格组件外部的此页面上有删除按钮,在其操作侦听器上,我正在从表格中删除选定的行,但在这种情况下,当表格更新时,只有表格项目被更新,但表格编辑器保持在同一位置,我如何刷新两者单击删除按钮时的表格编辑器和表格项目。