'recall method contains Thread in javafx [duplicate]

I have an FXML files (update.fxml) that contains excel path in textfield and progressBar.

In update.java controller I have:

public class Update extends Task<Integer>{
//----------------------------------------------------------------------
    @FXML
   void mImport(ActionEvent event) throws InterruptedException {
       Thread thread1 =new Thread(this);
       sPath="C:\\MyData\\test.xlsx"; //=path in the textfield (4000 rows)
            thread1.setDaemon(true);
               thread1.start();
}//end of mImport method
//----------------------------------------------------------------------
    @Override
    protected Integer call() throws Exception {
//lines of code..
    for (Row row : sheet) { //to read excel rows
//lines of code..
    updateProgress(count, NbrRows); // to update progressBar to show progress of reading rows
//lines of code..
return null;
}
}//end of call method
//----------------------------------------------------------------------'
    @FXML // This method is called by the FXMLLoader when initialization is complete
    void initialize() { 
        progressBar.progressProperty().bind(this.progressProperty());   
    }

My question is:

When I click my button that call import method it works first time, but if I click again nothing happens.

I know the problem is in the thread or task because it's running at first click, and I don't know how to stop it or make it at first statut



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source