您可以尝试在循环体内添加一个延时操作,以便进度条能够更慢地更新。例如,在每一次循环后延时100毫秒:
for (File sfile : sheetFiles) {
// 获取sfile的数据
ExportPojo exportPojo = ImportExcelUtils.importExcelToSheet(sfile.getPath(), ExcelPojo.class);
// 写出到指定文件
ImportExcelUtils.exportDataToSheet(file, exportPojo, zhu, fileName);
// 手动更新进度条
progress++;
System.out.println("progress = " + progress++);
updateProgress(progress, total);
Thread.sleep(100); // 添加延时操作
}
请注意,这样做可能会降低程序的性能,因为它会使程序暂停。另外,也可以尝试将延时时间调整为其他值,以便更好地适应您的需求。




