سؤال

وبداخل الجدول سبحانه وتعالى لدي العديد TableItems. أريد أن تحرك واحد منهم من مؤشر 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