title: How to return result from event handler in javafx?
body: <p>How to return result from event handler in javafx? I have bellow code, and how to return data from event to function showPrompt? Is it possible to recover the data for the function of the event?</p>
  
  <pre><code>public static String showPrompt(String title, String defValue){
            final Stage dlgStage = new Stage();
            TextField txtPromptValue = new TextField(defValue);
  
            Button btnOk = new Button("Ok");
            Button btnCancel = new Button("Cancel");
            btnOk.setOnAction(new EventHandler&lt;ActionEvent&gt;(){
                @Override
                public void handle(ActionEvent arg0) {
                    //How to return data from event to function?
                    dlgStage.close();
                }
            });
            btnCancel.setOnAction(new EventHandler&lt;ActionEvent&gt;(){
                @Override
                public void handle(ActionEvent arg0) { 
                    //How to return data from event to function?
                    dlgStage.close();
                }
            });
            //
            Label lblTitle = new Label(title);
            lblTitle.setFont(Font.font("Amble CN", FontWeight.NORMAL, 14));
            //
            VBox vbox = new VBox(lblTitle,txtPromptValue,btnOk,btnCancel);
            vbox.setAlignment(Pos.CENTER);
            vbox.setMinSize(300, 200);
            //
            Scene dlgScene = new Scene(vbox);
            //
            dlgStage.setScene(dlgScene);
            dlgStage.initStyle(StageStyle.UNDECORATED);
            dlgStage.initModality(Modality.APPLICATION_MODAL);
            dlgStage.setMinWidth(300);
            dlgStage.setMinHeight(200);
            dlgStage.show();       
  </code></pre>
  
  <p>}</p>