2
I need to call a ArrayList
raised in a JFrame
to another JFrame
. In this case, the user would make a registration in one of the Jframes, called Registration, and from this would create the User object, with login and password and this object will be allocated in an Arraylist. From this, the user goes to the login area and puts his login and password, in another Jframe, called login.
In this new Jframe, the program needs to check if the login and password match any of the logins and passwords of the objects created by the registrar, which are allocated in Arraylist. That’s why I need the Arraylist created in the file "Register" in the file "Login".
The code below in the first Jframe.
ArrayList<Usuario> lista = new ArrayList<>();
public ArrayList<Usuario> getLista() {
return lista;
}
public void setLista(ArrayList<Usuario> lista) {
this.lista = lista;
}
In the code below, in the second Jframe, where I need this Arraylist.
Usuario p;
List novalista = new Cadastro().getLista();
p = (Usuario) novalista.get(i);
To call the Jframe files, I use the push button action.
Cadastro frame = new Cadastro();
frame.setVisible(true);
this.dispose();
In the Login file (where I need to do the validations) I tried to pull several ways, but none works.
Please avoid long discussions in the comments; your talk was moved to the chat
– Math
Well, to start a conversation in a chat I need to have X reputation points, so the long discussion..
– Lucas Cosas
The message on my behalf above is automatically generated after I move the comments to the chat, but still it doesn’t ask you to have long discussions in the chat, it says to avoid long discussions, anywhere, and the ones that were here were moved to the chat. The ideal is that all the information needed to properly understand your question is present in the body of the question and not in the chat or comments.
– Math