我正在学习摇摆,并且对于在桌子上插入行有一个疑问.我的要求是我必须通过按添加按钮添加新行.但我无法继续.请找到以下代码:
如果有人知道请帮帮我....
{public class TableShellExample {
Display d;
Shell s;
TableViewer tableViewer;
CellEditor cellEditor;
TableShellExample(){
d = new Display();
s = new Shell();
s.setSize(250,250);
s.setText("Table Shell Example");
GridLayout g1 = new GridLayout();
g1.numColumns = 3;
s.setLayout(g1);
final Table table = new Table(s,SWT.BORDER |SWT.CHECK|SWT.MULTI | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 3;
table.setLayoutData(gd);
table.setHeaderVisible(true);
TableColumn tc1 = new TableColumn(table, SWT.LEFT);
TableColumn tc2 = new TableColumn(table,SWT.CENTER);
TableColumn tc3 = new TableColumn(table,SWT.CENTER);
tc1.setText("FIRST NAME");
tc2.setText("LAST NAME");
tc3.setText("ADDRESS");
tc1.setWidth(70);
tc2.setWidth(70);
tc3.setWidth(80);
TableItem …Run Code Online (Sandbox Code Playgroud)