Question

Dans une table SWT, j'ai plusieurs objets de table. Je souhaite déplacer l'un d'entre eux de l'index X à l'index Y. Y-a-t-il un moyen de faire ça? Comment?

Merci.

Était-ce utile?

La solution

Je ne pense pas qu'il existe une méthode directe pour le faire. Mais comme solution de contournement, essayez la méthode ci-dessous. J'ai utilisé quelque chose de similaire une fois.

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();

}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top