title: best way to get return type from a popup window JavaFx
body: <p>what the best way to get a return type from a popup window. im creating a popup window and that has fields that need to be filled in. i want to get the return type Person from these fields.</p>
  
  <p>heres where i call the popup window.</p>
  
  <pre><code>Button addButton = new Button("Add Person to interested list");
  AddPersonAdop adp = new AddPersonAdop();
  addButton.setOnAction(e -&gt; table.getItems().add(adp.addButtonPerson()));
  </code></pre>
  
  <p>heres the popup window class</p>
  
  <pre><code>public class AddPersonAdop {
  
      private TextField personNameAdoption, personAddressAdoption, personNoAdoption, personEmailAdoption;
  
      public Person display()  {
          final Stage  window = new Stage();
          BorderPane bP = new BorderPane();
  
          window.setTitle("Add Person");
  
          Button addPerson = new Button("Add Selected Animal");
          addPerson.setOnAction(e -&gt; {
              window.close();
              addButtonPerson();});
  
          Button closeButton = new Button("Close Window");
          closeButton.setOnAction(e -&gt; window.close());
  
          VBox vbox = new VBox(personFieldsAdoption(),  addPerson, closeButton);
          vbox.getChildren().addAll();
  
  
          bP.setCenter(vbox);
          Scene scene = new Scene(bP, 800,800);
  
          window.setScene(scene);
          window.show();
          return addButtonPerson();
  
      }
  
      public GridPane personFieldsAdoption(){
  
          personNameAdoption = new TextField();
          personNameAdoption.setPromptText("Name");
          personNameAdoption.setMinWidth(75);
  
          personAddressAdoption = new TextField();
          personAddressAdoption.setPromptText("Address");
          personAddressAdoption.setMinWidth(75);
  
          personNoAdoption = new TextField();
          personNoAdoption.setPromptText("Phone Number");
          personNoAdoption.setMinWidth(75);
  
          personEmailAdoption = new TextField();
          personEmailAdoption.setPromptText("Email");
          personEmailAdoption.setMinWidth(75);
  
          GridPane grid = new GridPane();
          grid.centerShapeProperty();
          grid.setHgap(10);
          grid.setPadding(new Insets(10,10,10,10));
          grid.addRow(0, CustomItems.label("Enter Persons Details"));
          grid.addRow(1, new Label("Person Name *"), new Label(" Address *"), new Label("Phone Number *"), new Label("Email *"));
          grid.addRow(2, personNameAdoption, personAddressAdoption, personNoAdoption, personEmailAdoption);
  
          return grid;
      }
  
      public Person addButtonPerson(){
  
          if(personNameAdoption.getText().isEmpty() || personAddressAdoption.getText().isEmpty() || personEmailAdoption.getText().isEmpty() || personNoAdoption.getText().isEmpty())
          {
              AlertBox.warn("Some Person Info Missing", "Please complete all Person mandatory fields");
              Person person = new Person("name","add","@", "999");
              return person;
          }
          else{
              Person person = new Person(personNameAdoption.getText(),personAddressAdoption.getText(),personEmailAdoption.getText(), personNoAdoption.getText());
              return person;
          }
      }
  
  }
  </code></pre>