title: Why am I getting java.lang.IllegalStateException "Not on FX application thread" on JavaFX?
body: <p>I have an application that has a <code>TableView</code> that has an attached listener so it refreshes as soon as it detects a change, but the thing is that I´m getting <code>java.lang.IllegalStateException: Not on FX application thread; currentThread = Smack Listener Processor (0)</code>.
  Here is my code: </p>
  
  <pre><code>/**
   * This function resets the pagination pagecount
   */
  public void resetPage() {
      try {
          System.out.println("RESET"); 
          int tamRoster = this.loginManager.getRosterService().getRosterList().size();
          paginationContactos.setPageCount((int)(Math.ceil(tamRoster*1.0/limit.get())));
          int tamEnviados = this.loginManager.getRosterService().getEnviadasList().size();
          paginationEnviadas.setPageCount((int)(Math.ceil(tamEnviados*1.0/limit.get())));
          int tamRecibidas = this.loginManager.getRosterService().getRecibidasList().size();
          paginationRecibidas.setPageCount((int)(Math.ceil(tamRecibidas*1.0/limit.get())));
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  public void doSomething () {
          this.loginManager.getRosterService().getRosterList().addListener(new ListChangeListener&lt;RosterDTO&gt;() {
              @Override
              public void onChanged(
                      javafx.collections.ListChangeListener.Change&lt;? extends RosterDTO&gt; c) {
                  // TODO Auto-generated method stub
                  resetPage();
                  while (c.next()) {
                      if (c.wasPermutated()) {
                          System.out.println("PERM");
                      } else if (c.wasUpdated()) {
                          System.out.println("UPD");
                      } else {
                          System.out.println("ELSE");
                      }
                  }
              }
           });
  }
  </code></pre>
  
  <p>Altough it enters the resetPage method, I get that exception.
  Why is this happening?
  How can I fix it?
  Thanks in advance.</p>