Create a user registry in Java

It is my first post. I'm not sure how that works.

I am creating a user registration system for a practice and have gotten stuck.

My user class is a User ArrayList, to initialize it, I entered a username and password.

The registration method is as follows:

Public Boolean register (user u) {
User newUser = u;
if (! (this.listaUsuarios.contains (newUser.getName ()))) {)
Userlist.add (u);
return true;
}
otherwise
return false;
}

Then I created another class called Registration, a graphical user interface with a button, a text box for the user and a password field. Inside the button is the ActionPerformed method.

The code is as follows:

Within the attributes of the class is the list of private users:

private user list;
,
,
,
,
private void btnRegActionPerformed (java.awt.event.ActionEvent evt) {

User newUser = new user (txtNewUser.getText (), pass.getText ());
if (list.register (newUser))
JOptionPane.showMessageDialog (this is "The user has been created", "window", JOptionPane.INFORMATION_MESSAGE);
otherwise
JOptionPane.showMessageDialog (this is "The user already exists", "window", JOptionPane.ERROR_MESSAGE);
} 

The problem is that when I start the interface and try to create a user, a compile error is displayed.