Table Editor
Hello everybody, I'm programming with Java 5 and SWT, and I need create a table where I can edit each cell, I have this code :
table =new Table(sShell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
table.setLinesVisible(true);
table.setHeaderVisible(true);
editor =new TableEditor(table);
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal =true;
TableColumn col1 =new TableColumn(table, SWT.None);
col1.setText("From");
col1.pack();
table.addSelectionListener (new SelectionAdapter(){
publicvoid widgetSelected(SelectionEvent e){
finalint EDITABLECOLUMN = 1;
//Clean up any previous editor control
Control oldEditor = editor.getEditor();
if (oldEditor !=null) oldEditor.dispose();
// Identify the selected row
TableItem item = (TableItem)e.item;
if (item ==null)return;
// The control that will be the editor must be a child of the Table
Text newEditor =new Text(table, SWT.NONE);
newEditor.setText(item.getText(EDITABLECOLUMN));
newEditor.addModifyListener(new ModifyListener(){
publicvoid modifyText(ModifyEvent e){
Text text = (Text)editor.getEditor();
editor.getItem().setText(EDITABLECOLUMN, text.getText());
}
});
newEditor.selectAll();
newEditor.setFocus();
editor.setEditor(newEditor, item, EDITABLECOLUMN);
}
});
but only I can modify the cells of the second column and not the cells of the first column...

