1
Good afternoon, I would like your help with Progressbar and Task in javafx.
I have a progression that have its value altered. I have the following code:
Task task = new Task<Integer>() {
@Override
protected Integer call() throws Exception {
for (int i = 1; i <= 427; i++) {
if (isCancelled()) {
break;
}
updateProgress(i, 427);
updateMessage("Atualizando: "+i+" de "+427);
Thread.sleep(1000);
}
return 427;
}
};
pbStatus.setProgress(1);
pbStatus.progressProperty().bind(task.progressProperty());
lbProgresso.textProperty().bind(task.messageProperty());
ExecutorService executor = Executors.newFixedThreadPool(427, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
return t;
}
});
executor.execute(task);
The problem is this, the code runs without any error, only it arrives at a certain point that my Progressbar (pbStatus) does not update anymore... Stands still at 21 / 91 of 427.
Does anyone know what it might be?
Thanks in advance.