title: Dynamically Updating a ListView from a TextField (JavaFX)
body: <p>I'm trying to apply names(strings) into a ListView within JavaFX using a simple event handler on a button, receiving input from TextFields. All the fields seem to be working and correct, it just doesnt update into the list view</p>
  
  <pre><code>    private ListView&lt;String&gt; manifestList;
      manifestList = new ListView&lt;&gt;();
      manifestList.setId("List");
      manifestList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
  </code></pre>
  
  <p>ListView add method:</p>
  
  <pre><code>   public void addtoList(String manifestlist){
      manifestList.getItems().add(manifestlist);
     }
  </code></pre>
  
  <p>For loop which generates text boxes for input (I have preset it to name1, name2 etc to test it)</p>
  
  <pre><code>    for( i = 0;i &lt; editname.length;i++){
      editname[i] = new TextField("Name" + i);    
      }
  </code></pre>
  
  <p>Button handler to add the text from textfields to the listview (There is 16 text boxes)</p>
  
  <pre><code> Button add = new Button("add");
  
      add.setOnAction(new EventHandler&lt;ActionEvent&gt;(){
          @Override
          public void handle(ActionEvent event){
  
              for(i=0; i&lt;16; i++){
              test.addtoList(editname[i].getText());
          }       
      }
  });
  </code></pre>
  
  <p>test is the variable name  for the class I am calling the add method from, which the list view is in. The button which is calling the add method, is in a different scene/class.</p>
  
  <p>I can't quite figure out what's going wrong here, i've printed the value of the textfields to console and they print fine - however they dont update into the ListView.</p>
  
  <p>I've tried using the add method with a preset string in the list view and that is added fine.</p>
  
  <p>Any help/tips would be great thanks.</p>