class BridgeServiceFX : BridgeService { val string = SimpleStringProperty() override fun getBrowserName(): String { println("started") println(Thread.currentThread().id) val dialog = TextInputDialog().apply { dialogPane.lookupButton(ButtonType.OK).disableProperty().bind(booleanBinding(editor.textProperty(), editor.textProperty()){value.isBlank()}) title = FX.messages["browsernametitle"] contentText = "Browser name" } if (Platform.isFxApplicationThread()) { println("running on FX thread") val ret = dialog.showAndWait() println(ret) } else { println("not on a fx thread") Platform.runLater { val run = FutureTask>(Callable {dialog.showAndWait()}) println(run) } } return "1" } }