TableEditor
を使用して、テーブルに異なるコントロールを配置しています。任意のコントロールを使用してswtテーブルのテキストコンテンツを取得する方法
...
TableItem [] items = table.getItems();
for (int i=0; i<items.length; i++) {
TableEditor editor = new TableEditor (table);
final Text text1 = new Text (table, SWT.NONE);
text1.setText(listSimOnlyComponents.get(i).getName());
text1.setEditable(false);
editor.grabHorizontal = true;
editor.setEditor(text1, items[i], 0);
editor = new TableEditor (table);
final CCombo combo1 = new CCombo (table, SWT.NONE);
combo1.setText("");
Set<String> comps = mapComponentToPort.keySet();
for(String comp:comps)
combo1.add(comp);
editor.grabHorizontal = true;
editor.setEditor(combo1, items[i], 1);
} //end of for
...
私はgetItem(i).getText
を使用してテーブルの上にテキストを取得しようとするのgetTextが、私はテーブルの上にテキストを表示されている場合でも、空の文字列を返すんなぜ、私は空の文字列
...
TableItem [] items = table.getItems();
for(int i=0; i<items.length; i++) {
TableItem item = items[i];
String col0text = items[i].getText(0); //this text is empty
String col1text = items[i].getText(1); //this text is empty
}
...
を取得しますか?
この例では、getText(0)は "TEST"を返し、getText(1)はコンボボックスの選択( "A"、 "B"または "C")を返します。しかし、それはこのように動作しないようです。これを達成する方法はありますか? –