2012-04-06 8 views
0

SWTテーブルに行を追加するAddボタンがあり、行を編集するためにTableEditorを実装しました。SWT TableItemにフォーカスを設定するには

Button button = new Button(composite, SWT.NONE); 
    button.addSelectionListener(new SelectionAdapter() { 
    @Override 
    public void widgetSelected(SelectionEvent e) { 
     TableItem item = new TableItem(table, SWT.NONE); 
       } 
    }); 

、これはテーブル作成

table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION); 
    table.setBounds(0, 0, 240, 160); 
    toolkit.adapt(table); 
    toolkit.paintBordersFor(table); 
    table.setHeaderVisible(true); 
    table.setLinesVisible(true); 

ユーザが追加ボタンをヒットするためのコードの一部では、行は、ユーザが編集できるように作成されます。しかし、ユーザーの視点から見ると、その行が作成されたかどうかはわかりません。

新しく追加されたTableItemにフォーカスを設定する方法をお勧めしますか?

答えて

1

Table.setSelection()およびTable.showItem()APIを参照してください。