javafx-9

How to wait for user input on JavaFX application thread without using showAndWait?

核能气质少年 提交于 2019-11-27 05:37:26
I'd like to pause the execution of a method on the JavaFX application thread and wait until the user does interaction with the UI. It's important not to freeze the UI. Example: Button start = ... Button resume = ... start.setOnAction(evt -> { System.out.println("starting"); start.setDisable(true); System.out.println("please press resume button."); pause(); System.out.println("done"); start.setDisable(false); }); resume.setOnAction(evt -> resume()); How should I implement the pause() and resume() methods? The execution of the event handler should wait at pause(); call until the user presses the

How to wait for user input on JavaFX application thread without using showAndWait?

时光总嘲笑我的痴心妄想 提交于 2019-11-26 10:03:25
问题 I\'d like to pause the execution of a method on the JavaFX application thread and wait until the user does interaction with the UI. It\'s important not to freeze the UI. Example: Button start = ... Button resume = ... start.setOnAction(evt -> { System.out.println(\"starting\"); start.setDisable(true); System.out.println(\"please press resume button.\"); pause(); System.out.println(\"done\"); start.setDisable(false); }); resume.setOnAction(evt -> resume()); How should I implement the pause()