TableItemのインデックスを変更するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/1202905

  •  05-07-2019
  •  | 
  •  

質問

SWTテーブルの内部には、多くのTableItemがあります。 そのうちの1つをインデックスXからインデックスYに移動します。 それを行う方法はありますか?方法は?

ありがとう。

役に立ちましたか?

解決

これを行う直接的な方法はないと思います。しかし、回避策として、以下の方法を試してください。似たようなものを一度使用しました。

public void moveTableItem(Table table, int from, int to) {
    TableItem item2Move = table.getItem(from);
    TableItem newTableItem = new TableItem(table, SWT.NONE, to);
    newTableItem.setText(item2Move.getText());
    // You may want to clone the entire item here; and not just the text.

    // Dispose off, the old item.
    item2Move.dispose();

}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top