Jump to content

Recommended Posts

Posted (edited)

Boa tarde!!

Estou a fazer um programa em que é registado os clientes (nome, idade, morada...) e pretendo que a pessoa que vai usar o software tenha um login para aceder ao programa que regista os clientes, como faço isso?

criei uma classe chamada login (nome e senha) e base de dados também com as mesmas variáveis:

public class Login implements java.io.Serializable {

private long id;
private String nome;
private String senha;



public Login(long id, String nome, String senha) {
super();
this.id = id;
this.nome = nome;
this.senha = senha;
}
public Login(String nome, String senha) {
super();
this.nome = nome;
this.senha = senha;
}


public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
result = prime * result + ((senha == null) ? 0 : senha.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Login other = (Login) obj;
if (id != other.id)
return false;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return false;
if (senha == null) {
if (other.senha != null)
return false;
} else if (!senha.equals(other.senha))
return false;
return true;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Login [id=").append(id).append(", nome=").append(nome)
.append(", senha=").append(senha).append("]");
return builder.toString();
}

}

Como é que consigo fazer com que essa senha e o nome façam aceder ao programa?

Obrigado

Edited by Baderous
geshi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.