Pregunta

Dentro de una tabla SWT tengo muchos TableItems. Quiero mover uno de ellos del índice X al índice Y. ¿Hay una manera de hacerlo? ¿Cómo?

Gracias.

¿Fue útil?

Solución

No creo que haya un método directo para hacer esto. Pero como solución alternativa, pruebe el siguiente método. He usado algo similar una vez.

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

}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top