private User user = new User(login, password);
private User user1 = new User(login, password);
private RegistrationView registrationView = new RegistrationView(user);
When I setVisible(true) for this form, it get information about user, and setValue in components according to user’s information. BUT if I will change user like
user = user1;
then form doesn’t get this information about user1, but contains information about user.
I also tried make it
registrationView = new RegistrationView(user1);
but after it I doesn’t arrear.
How can I solve this problem, if I need to get information about user1, after information about user?
instead of passing the User as a parameter to the constructor of RegistrationView, you should add a public method like updateUser(User user) and update the contents of the view there. Changing the user object pointer or the view pointer won’t do anything automatically.