1

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?

Thanks

6
  • 2
    Put it in a Thread or use Platform.runLater(() -> progressBar.setProgress(progressValue)); Mar 9, 2015 at 11:54
  • 1
    Please post some code showing what you're doing. Ideally you should create a complete example which can be executed directly and which demonstrates the problem.
    – James_D
    Mar 9, 2015 at 11:56
  • I don't know who just downvoted a javafx question i asked 1 1/2 year ago, but please quit that childish behaviour. I didn't downvote anything in this question. Mar 9, 2015 at 12:14
  • Thank you WonderWorld, I thought that might be the method to use. Thanks for confirming.
    – re0603
    Mar 9, 2015 at 12:16
  • Which one you are using, to put the code in a thread or the Platform.runlater? Mar 9, 2015 at 12:20

1 Answer 1

3

You can put the progressbar progress in a Platform.runLater(()-> progressBar.setProgress(progressValue)); so it will be executed at a later point in time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.