JavaFX程序在运行时锁定/冻结 [英] JavaFX program locks/freezes whilst running
问题描述
我正在尝试创建一个正在运行的JavaFX程序 - 但我正在尝试让进度条在运行时进行更新。
I'm trying to create a JavaFX program, which is working - but I am trying to get a progress bar to update whilst it is running.
但是,该程序似乎冻结并锁定,直到它完成处理。
However, the program just seems to freeze and locks up until it has finished processing.
有没有人知道如何让程序在运行时不冻结 - 并且获得进度条进行处理时更新?
Does anyone have an idea of how I can get the program not to freeze whilst running - and to get the progress bar to update whilst it processes?
谢谢
推荐答案
您可以将进度条进度放在 Platform.runLater(() - > progressBar.setProgress(progressValue));
中,以便稍后执行。
You can put the progressbar progress in a Platform.runLater(()-> progressBar.setProgress(progressValue));
so it will be executed at a later point in time.
这篇关于JavaFX程序在运行时锁定/冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!