Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java SWT: Clear all items in a table before writing

Tags:

java

swt

How do I clear a table before writing all the rows? The data will be completely different every time I hit this code:

graphicsMemoryTable.setRedraw(false);
int count = 0;
for(int i=0; i<graphicsMemory.size() && count<1000; i+=8,count++)
{
    TableItem item = new TableItem(graphicsMemoryTable, SWT.NONE);
    item.setText(graphicsMemory.get(i).toString());
    item.setText(1,graphicsMemory.get(i+1).toString());
    item.setText(2,graphicsMemory.get(i+2).toString());
    item.setText(3,graphicsMemory.get(i+3).toString());
    item.setText(4,graphicsMemory.get(i+4).toString());
    item.setText(5,graphicsMemory.get(i+5).toString());
    item.setText(6,graphicsMemory.get(i+6).toString());
    item.setText(7,graphicsMemory.get(i+7).toString());
}
graphicsMemoryTable.setRedraw(true);

EDIT: For reference, calling removeAll() worked for me, calling clearAll did not

like image 755
Robben_Ford_Fan_boy Avatar asked Dec 08 '25 07:12

Robben_Ford_Fan_boy


1 Answers

removeAll() method of Table will remove all elements in the table. Here is the javadoc;

public void removeAll()

Removes all of the items from the receiver.

like image 101
erolkaya84 Avatar answered Dec 09 '25 21:12

erolkaya84