在 JavaFX 应用程序中下载文件时出现 "This app is not responding"
While downloading file in JavaFX app "This app is not responding" appears
我想下载一个文件,等待下载完成,这样就不会出现“无响应”的错误。
if(isNeedToReDownload){
launchStatus.setText(LaunchStatus.DOWNLOADING.status);
downloadThread = new Thread(() -> {
for(File file : launchDir.listFiles()){
file.delete();
}
launchDir.delete();
downloadClient();
downloadMods();
});
downloadThread.start();
}
if(downloadThread != null){
downloadThread.join();
downloadThread.stop();
}
}
launchStatus.setText(LaunchStatus.STARTING.status);
创建(无论可见与否)进度条。并在循环和其他事情上更新进度条。
我想下载一个文件,等待下载完成,这样就不会出现“无响应”的错误。
if(isNeedToReDownload){
launchStatus.setText(LaunchStatus.DOWNLOADING.status);
downloadThread = new Thread(() -> {
for(File file : launchDir.listFiles()){
file.delete();
}
launchDir.delete();
downloadClient();
downloadMods();
});
downloadThread.start();
}
if(downloadThread != null){
downloadThread.join();
downloadThread.stop();
}
}
launchStatus.setText(LaunchStatus.STARTING.status);
创建(无论可见与否)进度条。并在循环和其他事情上更新进度条。