java - UI freezing while application making some calculations -


i have java fx application many tableviews. how knows in javafx tableview there databinding, working in 2 directions. when application making calculcations data tableviws ui freezing, because application updates data tableviews(observablelist). did tried use platform.runlater, didn't helped me. ideas?

platform.runlater delays runnable - yet again run on ui-thread hence block every user input during execution.

the solution quite simple, use worker thread :

task task = new task<void>() {     @override public void call() {         static final int max = 1000000;         (int i=1; i<=max; i++) {             if (iscancelled()) {                break;             }             updateprogress(i, max);         }         return null;     } }; progressbar bar = new progressbar(); bar.progressproperty().bind(task.progressproperty()); new thread(task).start(); 

although advisable use executorservice class since allows more controlled behaviour : http://java-buddy.blogspot.de/2012/06/example-of-using-executorservice.html


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -