title: Return the choice of a combobox javafx
body: <p>I have an app with 2 ComboBox and I would like to return the choice of the user into a variable. How should I do it ? 
  Here is my controller class : </p>
  
  <pre><code>package ch.makery.adress;
  
  import java.awt.FileDialog;
  import javafx.fxml.Initializable;
  import java.net.URL;
  import java.util.ResourceBundle;
  import javax.swing.JFrame;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.scene.control.ComboBox;
  import javafx.scene.control.TextField;
  
  public class HexaController implements Initializable {
         static JFrame fileDialog;
          @FXML
          private ComboBox&lt;String&gt; hexa;
          ObservableList&lt;String&gt; list = FXCollections.observableArrayList();
          @FXML
          private TextField entree;
  
          @FXML
          private TextField excel;
  
          @FXML
          private TextField sortie;
  
  
          @FXML
          private void dar(ActionEvent event){
              FileDialog fd1=new FileDialog(fileDialog,"Choisissez un fichier d'entree",FileDialog.LOAD);
              fd1.setDirectory("C:\\");
              fd1.setVisible(true);
              String filename1=fd1.getFile();
              String Directory1=fd1.getDirectory();
              String path1=Directory1 + filename1;
              entree.setText(path1);
          }
  
          @FXML
          private void modele(ActionEvent event){
              JFrame parentFrame=new JFrame();
               FileDialog filechooser = new FileDialog (parentFrame, "Choisir un modèle Excel à copier",FileDialog.LOAD);
               filechooser.setDirectory("C:\\");
               filechooser.setVisible(true);
               String directory_copy = filechooser.getDirectory();
               String name_copy= filechooser.getFile();
               String path_copy = (directory_copy+name_copy);
               excel.setText(path_copy);
          }
  
          @FXML
          private void sortie (ActionEvent event){
              JFrame parentFrame2=new JFrame();
               FileDialog filechooser2 = new FileDialog (parentFrame2, "Choisir une destination d'enregistrement",FileDialog.SAVE);
               filechooser2.setDirectory("C:\\");
               filechooser2.setVisible(true);
               String directory_save = filechooser2.getDirectory();
               String name_save= filechooser2.getFile();
               String path_save = (directory_save+name_save+".xls");
               sortie.setText(path_save);
          }
          @FXML
          private void annuler (ActionEvent event){
              System.exit(0);
          }
  
  
          @FXML
          private ComboBox&lt;Integer&gt;methode;
          ObservableList&lt;Integer&gt;nombre = FXCollections.observableArrayList();
  
  
  
  public HexaController(){
  
  }
  
  public void initialize(URL url,ResourceBundle rb){
  
      list.add(new String("OUI"));
      list.add(new String("NON"));
      hexa.setItems(list);
      nombre.add(new Integer(0));
      nombre.add(new Integer(1));
      nombre.add(new Integer(2));
      nombre.add(new Integer(3));
      nombre.add(new Integer(4));
      nombre.add(new Integer(5));
      methode.setItems(nombre);
  }
  }
  </code></pre>
  
  <p>I need to use that variable to change the way the app is going to work. And on the "methode" combobox I want a new window with a number of TextField. For exemple If the user choose 3 it will open a new window with 3 textField or (if it's possible just add 3 TestField below the combobox)
  Thanks</p>