private fun internalInputDialog(title: String, header: String, content: String): Optional { val dialog = TextInputDialog() val okButton = dialog.dialogPane.lookupButton(ButtonType.OK) as Button val editor = dialog.editor okButton.isDisable = true editor.textProperty().addListener { observable, oldValue, newValue -> okButton.isDisable = newValue.trim { it <= ' ' }.isEmpty() } dialog.title = title dialog.contentText = content dialog.headerText = header val result = dialog.showAndWait() return result } fun inputDialog(title: String, header: String, content: String): String? { var ret: String? = null val query = FutureTask(Callable { internalInputDialog(title, header, content) }) Platform.runLater(query) try { val identifier = query.get() if (identifier.isPresent && !identifier.get().trim().isEmpty()) ret = identifier.get() } catch (e: InterruptedException) { e.printStackTrace() } catch (e: ExecutionException) { e.printStackTrace() } return ret }