gpt4 book ai didi

Java SWT : Clear all items in a table before writing

转载 作者:行者123 更新时间:2023-11-29 09:59:53 25 4
gpt4 key购买 nike

如何在写入所有行之前清除表格?每次我敲这段代码,数据都会完全不同:

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

编辑:作为引用,调用 removeAll() 对我有用,调用 clearAll 却没有

最佳答案

Table

removeAll() 方法将删除表格中的所有元素。这是 javadoc;

public void removeAll()

Removes all of the items from the receiver.

关于Java SWT : Clear all items in a table before writing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37720041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com