title: Java, JDialog: Returning value after dispose()
body: <p>first of all, i don't speak correct english, and sorry for that!</p>
  
  <p>I am making a stock system in Java, and it's working, but i have a doubt about the correct use of <code>dispose()</code> from JDialog instance.</p>
  
  <p>My code:</p>
  
  <pre><code>public Usuario getUsuario() {
      this.setVisible(true);
      this.dispose();
      return new VentanaConfigurarPrivilegios(new Usuario(textField.getText(), new String(passwordField.getPassword()))).getUsuario();
  }
  </code></pre>
  
  <p>this function works and returns a new <code>Usuario</code> from the new Instance of <code>VentanaConfigurarPrivilegios</code> calling to <code>getUsuario()</code>, but the doubt is about the last 2 lines, i'm disposing the JDialog, and after, is passing a text from textFields, it work fine, but i'm not sure that i am doing this in a correct way, and i would not like that the code fails when is using. </p>
  
  <p>Again, sorry for my english!! Thanks.</p>