I am using JavaFx for creating a Java Standalone Application.
I have seen some examples but I am not able to understand how to use the javaFX Task
in my code scenario.
This is the Controller function which I am calling for Button onAction which I have set from SceneBuilder -->
public class MainScreenController {
@FXML
private JFXButton btnSelectImg;
@FXML
private ImageView imageViewObj;
@FXML
private ProgressBar progressBarObj;
//..
//..
@FXML
private void onFileSelectButtonClick() {
//Some Operations are carried out
//..
//Then I want to set Image in ImageView
imageViewObj.setImage(myImage);
// Some Code Here
//..
// Set Progress
progressBarObj.setProgress(0.1);
// Some Code Here
//..
// Set Progress
progressBarObj.setProgress(0.2);
//...
//...
// Maybe change some other Controls
//..........
}
//..
//..
}
Now here I am updating multiple controls in the same function gradually as the code progresses step by step but it gets updated at last when execution is done.
I want to update the controls while execution as shown in the code.