I tried using thread.sleep()PauseTransitionbut all of them make my program stuckSo, I am hoping to get advice on how I can delay my loop before calling other job
public class LinkedListController implements Initializable { LinkedList<Job> joblist = new LinkedList<>(); int processnum = DesignController.processnum; int[] BurstTime = new int[5]; ProgressBar[] progress = new ProgressBar[5]; int CurrentTime = 0; int StartTime = 0; @FXML private Label plabel1,plabel2,plabel3,plabel4,plabel5; @FXML ProgressBar progress1,progress2,progress3,progress4,progress5; double val = 0.0; Job J; @FXML void checkAction(ActionEvent event) throws IOException { if(DesignController.Comboboxtext == "FCFS") { J = joblist.removeFirst(); while (joblist.isEmpty()!=true) { // Create a new timeline for each process Timeline timeline = new Timeline(); KeyFrame keyFrame = new KeyFrame(Duration.seconds(J.BurstTime), new KeyValue(J.pbar.progressProperty(), 1)); timeline.getKeyFrames().add(keyFrame); timeline.setOnFinished((EventHandler<ActionEvent>) new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println(J.pbar.getId() +" completed"); }}); timeline.play(); }}} }