KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm new with JavaFX and I've a little problem with a thread: I can execute it twice and I can't find why. Here is a sum-upt of my code: Task<Void> task = new Task<Void>() { @Override public Void call() throws ImageLoadedException, HomographyException, IOException { try{ System.out.println("GO !"); return null; } catch (Exception e){ e.printStackTrace(); } return null; } @Override protected void succeeded() { super.succeeded(); System.out.println("SUCCEEDED"); } }; @FXML protected void launch(ActionEvent event){ new Thread(task).start(); } When I click a first time the button who start my thread, my task run without any problem (my console display "GO !" and "SUCCEEDED"). But if I click a second time, nothing append. Am I doing something wrong ? Can't we use a thread more than once ?
Tags (comma-separated)
Save Edits
Cancel