title: JavaFX / how to load/populate values at start up?
body: <p>I started working with JavaFX just today and already need some advise. I load the <code>applicaton.fxml</code> (created with Oracle SceneBuiler) using the FXMLLoader in the <code>start(Stage ...)</code> method of the MainApplication (which has an ApplicationController specified in my <code>application.fxml</code> file).</p>
  
  <pre><code>&lt;AnchorPane id="AnchorPane" disable="false" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" styleClass="theme" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="app.AppController"&gt;
  ...more code here...
  &lt;ComboBox id="cmb_locations" fx:id="cmb_locations"&gt;
      &lt;items&gt;
          &lt;FXCollections fx:factory="observableArrayList"&gt;
              &lt;String fx:value="Item 1" /&gt;
              &lt;String fx:value="Item 2" /&gt;
              &lt;String fx:value="Item 3" /&gt;
          &lt;/FXCollections&gt;
      &lt;/items&gt;
  &lt;/ComboBox&gt;
  </code></pre>
  
  <p>Now, I have a <code>ComboBox</code> in the <code>applicaton.fxml</code>, which has three items (the default items). What I need is to populate that <code>ComboBox</code> during the startup with my own values. Does anyone know how to achieve that and where to put the relevant code snippets (<code>app.AppController</code> or something similar)? Thanks in advance.</p>