title: Setting Combobox value when switching screens
body: <p>I want to switch between FXML-Files with Radiobuttons without losing the Combobox-Selection. "secSelectionModel()" seems to add a Selection, but its not visually shown.</p>
  
  <pre><code>public class Controller {
      static SingleSelectionModel cbxSelection;
      @FXML private ComboBox&lt;String&gt; cbx = new ComboBox&lt;&gt;();
      @FXML private RadioButton radio1 = new RadioButton();
      @FXML private RadioButton radio2 = new RadioButton();
  
      @FXML private void cbxFill(){
          cbx.getItems().setAll("eins","zwei");
      }
  
      @FXML private void screenSwitch() throws IOException {
          Stage stage;
          Parent root;
  
          if(radio1.isSelected()){
              stage=(Stage) radio1.getScene().getWindow();
              root = FXMLLoader.load(getClass().getResource("sample.fxml"));
              //cbxFill();
              cbx.setSelectionModel(cbxSelection);
          }
          else{
              stage=(Stage) radio2.getScene().getWindow();
              root = FXMLLoader.load(getClass().getResource("sample2.fxml"));
              //cbxFill();
              cbx.setSelectionModel(cbxSelection);
          }
          Scene scene = new Scene(root);
          stage.setScene(scene);
          stage.show();
      }
      @FXML private void getcbxSelection(){
          cbxSelection=cbx.getSelectionModel();
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Qr73O.jpg" rel="nofollow noreferrer">If Radio2 is selected, I want to switch to Screen2 without losing the Entered Selection in the Combobox. </a></p>