Getting ComboBox value from another window TextField Control
<p>I have two javaFx window. The first has a <code>ComboBox</code> and a <code>Button</code> to open second modal window.</p>

<p>In second window have a <code>TextField</code> and a <code>Button</code> <code>Control</code> to add the textField value to <code>MainController</code> Window's <code>ComboBox</code>. I am not getting any idea that how to do it. With a explained Example would great helpful for me. Below is the classes:</p>

<p>Main.java</p>

<pre><code>package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("Hello World");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}
</code></pre>

<p>Contrller.java</p>

<pre><code>package sample;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.Modality;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

public class Controller implements Initializable{
    @FXML
    public ComboBox&lt;String&gt; combo;
    @FXML
    Button button;
    public ObservableList&lt;String&gt; list = FXCollections.observableArrayList("A");
    @Override
    public void initialize(URL location, ResourceBundle resources) {
        setCombo();

    }

    public void setCombo(){
        combo.setItems(list);
    }

    public void openModal() throws IOException {
        Stage primaryStage = new Stage();
        Parent root = FXMLLoader.load(getClass().getResource("sec.fxml"));
        primaryStage.setTitle("Send Mail");
        primaryStage.setScene(new Scene(root,800,600));
        primaryStage.initModality(Modality.WINDOW_MODAL);
        //primaryStage.initOwner((Stage) menuBar.getScene().getWindow());
        primaryStage.show();
    }
}
</code></pre>

<p>FXML for Main Window:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;?import javafx.scene.control.Button?&gt;
&lt;?import javafx.scene.control.ComboBox?&gt;
&lt;?import javafx.scene.control.Label?&gt;
&lt;?import javafx.scene.layout.HBox?&gt;
&lt;?import javafx.scene.layout.StackPane?&gt;
&lt;?import javafx.scene.layout.VBox?&gt;

&lt;VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller"&gt;
    &lt;children&gt;
        &lt;StackPane prefHeight="67.0" prefWidth="600.0"&gt;
            &lt;children&gt;
                &lt;Label text="Get value from Another Child Dialog" /&gt;
            &lt;/children&gt;
        &lt;/StackPane&gt;
        &lt;HBox prefHeight="100.0" prefWidth="200.0"&gt;
            &lt;children&gt;
                &lt;Label text="Add Value of TextBox:" /&gt;
                &lt;ComboBox fx:id="combo" prefWidth="150.0" /&gt;
            &lt;/children&gt;
        &lt;/HBox&gt;
        &lt;Button fx:id="button" mnemonicParsing="false" onAction="#openModal" text="Open Dialog" /&gt;
    &lt;/children&gt;
&lt;/VBox&gt;
</code></pre>

<p>Now Second window Sec.Java</p>

<pre><code>package sample;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;

/**
* Created by tracedot on 12/11/16.
*/
public class Sec implements Initializable{
    @FXML
    Button button;
    @FXML
    TextField textfield;
    public Controller controller=new Controller();

    public void setToCombo(){
        String cbvalue= textfield.getText();
        controller.combo.getItems().add(cbvalue);
        //controller.combo.itemsProperty().setValue(new ArrayList&lt;String&gt;().add());
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        //setToCombo();

    }
}
</code></pre>

<p>Second window FXML:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;?import javafx.scene.control.Button?&gt;
&lt;?import javafx.scene.control.TextField?&gt;
&lt;?import javafx.scene.layout.HBox?&gt;

&lt;HBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Sec"&gt;
    &lt;children&gt;
        &lt;TextField fx:id="textfield" /&gt;
        &lt;Button fx:id="button" mnemonicParsing="false" onAction="#setToCombo" text="Add to Combo" /&gt;
    &lt;/children&gt;
&lt;/HBox&gt;
</code></pre>