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...

[2542 byte] By [jcgonzalesa] at [2007-11-26 13:56:56]
# 1
Really, I need this code,please if someone know the result, please give me it...thanks
jcgonzalesa at 2007-7-8 1:36:45 > top of Java-index,Java Essentials,Java Programming...
# 2
> Really, I need this code,please if someone know the> result, please give me it...thanksI would suggest you find an SWT forum to ask this question. You are in the wrong place.
zadoka at 2007-7-8 1:36:45 > top of Java-index,Java Essentials,Java Programming...