first of all, i don't speak correct english, and sorry for that!
I am making a stock system in Java, and it's working, but i have a doubt about the correct use of dispose()
from JDialog instance.
My code:
public Usuario getUsuario() {
this.setVisible(true);
this.dispose();
return new VentanaConfigurarPrivilegios(new Usuario(textField.getText(), new String(passwordField.getPassword()))).getUsuario();
}
this function works and returns a new Usuario
from the new Instance of VentanaConfigurarPrivilegios
calling to getUsuario()
, 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.
Again, sorry for my english!! Thanks.