List of usage examples for javafx.concurrent Service stateProperty
@Override public final ReadOnlyObjectProperty<State> stateProperty()
From source file:mesclasses.objects.LoadWindow.java
private void temporize(long millis) { Service<Object> service = new Service() { @Override/* w w w . j a v a2 s . c o m*/ protected Task createTask() { return new WaitTask(millis); } }; service.stateProperty().addListener( (ObservableValue<? extends Worker.State> o, Worker.State oldValue, Worker.State newValue) -> { switch (newValue) { case FAILED: case CANCELLED: successful = false; dialogStage.close(); break; case SUCCEEDED: next(); } }); service.start(); }