My problem is that I can not start a new modal window in Task, it just does not go out. I do not understand how it is possible to derive not just an allert, but any modal window from Task. Translated by Google =)
Task<Void> task = new Task<Void>() {
@Override
public Void call() throws ApiException,ClientException,InterruptedException {
int i = 0;
for ( i = 0; i < bufferLenght; i++){
try {
...some code
}catch(ApiCaptchaException e) {
...get capcha
captchaSid = e.getSid();
captchaImg = e.getImage();
System.out.println( captchaSid);
}
System.out.println(captchaSid);
if (captchaSid != null) {
System.out.println("gg");
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Test Connection");
//here he is stuck
alert.setHeaderText("Results:");
alert.setContentText("Connect to the database successfully!");
alert.showAndWait();
System.out.println("gg3");
if(i<bufferLenght-1) {
Thread.sleep(2000);
}
}
return null;
}
};
new Thread(task).start();