title: JavaFX: How can I use correctly a ProgressIndicator in JavaFX
body: <p>I´m newbe in JavaFX.
  I have a problem with my JavaFX application, I need to start my ProgressIndicator (type INDETERMINATE) before a database query.
  This is part of my code:</p>
  
  <pre><code>spinner.setVisible(true);
  passCripto = cripto.criptoPass(pass);
  MyDao dao = new MyDaoImpl();
  boolean isLoginOk = dao.isUserOk(user, passCripto);
  boolean isStatusOk = dao.idStatusUser(user);
  </code></pre>
  
  <p>When finished, I need to set spinner to FALSE but the spinner only is showed when database query is finished. How can I solve this ?</p>
  
  <p>Thanks.</p>
  
  <p>I do this, but not resolved:</p>
  
  <pre><code>Task&lt;Boolean&gt; taskValidaLogin = new Task&lt;Boolean&gt;() {
      @Override
      protected Boolean call() throws Exception {
          boolean validaLogin = ACDCDao.validaUsuario(usuario, senhaCripto);
  
          return validaLogin;
      }
  };
  
  Task&lt;Boolean&gt; taskValidaStatus = new Task&lt;Boolean&gt;() {
      @Override
      protected Boolean call() throws Exception {
          boolean validaStatus = ACDCDao.validaStatusUsuario(usuario);
  
          return validaStatus;
      }
  };
  
  new Thread(taskValidaLogin).start();
  new Thread(taskValidaStatus).start();
  if (taskValidaLogin.getValue()) {
      if (taskValidaStatus.getValue()) {
          //do something
      }
  </code></pre>