能不能在已经显示的table上再增加一些行
或这替换掉以前存在的行数据呢?
我编的这个好象不行啊~~
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;public class SWTTest {
private Shell shell;
private Display display;
Table table;
Composite parent;
public SWTTest(Shell shell){
this.shell = shell;
FillLayout fillLayout = new FillLayout();
  fillLayout.type = SWT.VERTICAL;
  this.shell.setLayout(fillLayout);
parent = new Composite(shell, SWT.NO_FOCUS);
parent.setLayout(fillLayout);
createTable();
}
public void createTable(){
table = new Table(parent, SWT.MULTI |SWT.BORDER);
table.setLinesVisible(true);
table.setHeaderVisible(true);
TableColumn tableColumn = new TableColumn(table,SWT.LEFT);
tableColumn.setText("1");
tableColumn.setWidth(50);
TableColumn tableColumn2 = new TableColumn(table,SWT.LEFT);
tableColumn2.setText("2");
tableColumn2.setWidth(50);
Display.getCurrent().asyncExec(new Runnable(){
public void run(){
while(true){
try{
Thread.sleep(1000);
}catch(Exception e){}
TableItem item = new TableItem(table,SWT.CENTER);

item.setText(0, "1");
item.setText(1, "2");

}

}
});
}

public static void main(String[] args){
Display display = new Display();
Shell shell = new Shell(display);
new SWTTest(shell);
shell.open();
while(!shell.isDisposed()){
if(!display.readAndDispatch())
display.sleep();
}
display.dispose();
}}