I want to run a progressBar in a thread that shows the progress of a file loading procedure. The progress of the progressBar is dependent on the time of loading the file into a variable. The following code snippet shows the Thread.
double progress=0;
new Thread(){
public void run() {
final double step = progress; //error: local variables referenced from an inner class must be final or effectively final
Platform.runLater(() -> pbs.setProgress(step));
}
}.start();
I'm aware of the impossibility of assigning the value of progress in an inner class but in any case I'm still trying to find a solution for forcing of getting values from a local variable. Are there any alternative solutions or approaches of getting values from a local variable?