table_short = new Table (composite_short, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
GridData gd_table = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_table.heightHint = 104;
gd_table.widthHint = 639;
table_short.setLayoutData(gd_table);
table_short.setLinesVisible(true);
table_short.setHeaderVisible(true);
table_short.setSize (100, 100);
TableColumn tableColumn = new TableColumn(table_short, SWT.NONE);
tableColumn.setWidth(20);
tableColumn.setText("");
TableColumn tableColumn_1 = new TableColumn(table_short, SWT.NONE);
tableColumn_1.setWidth(100);
tableColumn_1.setText("a");
TableColumn tableColumn_2 = new TableColumn(table_short, SWT.NONE);
tableColumn_2.setWidth(100);
tableColumn_2.setText("b");
TableColumn tableColumn_3 = new TableColumn(table_short, SWT.NONE);
tableColumn_3.setWidth(100);
tableColumn_3.setText("c");
TableColumn tableColumn_4 = new TableColumn(table_short, SWT.NONE);
tableColumn_4.setWidth(100);
tableColumn_4.setText("d");
TableColumn tableColumn_5 = new TableColumn(table_short, SWT.NONE);
tableColumn_5.setWidth(100);
tableColumn_5.setText("e");
TableColumn tableColumn_6 = new TableColumn(table_short, SWT.NONE);
tableColumn_6.setWidth(100);
tableColumn_6.setText("f");
table_short.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
String string = event.detail == SWT.CHECK ? "Checked" : "Selected";
TableItem[] titem = table_short.getItems();
for(int i = 0; i < titem.length; i++){
if(!event.item.equals(titem[i])){
titem[i].setChecked(false);
}
}
System.out.println (event.item + " " + string);
}
});
for (int i=0; i<5; i++) {
TableItem item = new TableItem (table_short, SWT.NONE);
item.setText (new String[]{"", "item1"+i,"item2"+i,"item3"+i,"item4"+i,"item5"+i,"item6"+i,});
}