All the coding runs, my only problem is that the progress bar doesn't display the value changes. I set the values, but if I run it the value set, doesn't display on the progress bar. (The bar doesn't fill up)
public void logIn() {
try {
while (true) {
calculate();
System.out.println(loadingProgress);
if (loadingProgress < 100) {
mGUI.pbLoading.setValue(loadingProgress);
Thread.sleep(random.nextInt(5000) + 100);
} else {
mGUI.pbLoading.setValue(100);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void calculate() {
random = new Random();
loadingProgress = loadingProgress + random.nextInt(9) + 1;
}
The calculation has to be done in an extra thread. This is because the currently running thread is blocking the repaint of the UI until the calculation is done.