Eu estou tentando criar um cadastro e um login no jform, porem parece que o meu vetor não esta salvando as informaçoes, alguem consegue entender o porque?
Esse é o meu código:
//Cadastro
if(rbtnAluno.isSelected()){
aluno.setUsuario(txtCadastroUsuario.getText());
aluno.setSenha(txtCadastroSenha.getText());
aluno.setEmail(txtCadastroEmail.getText());
aluno.setTelefone(txtCadastroTelefone.getText());
aluno.setNome(txtCadastroNome.getText());
aluno.setDataNascimento(txtCadastrodataNascimento.getText());
aluno.setEndereco(txtCadastroEndereco.getText());
JOptionPane.showMessageDialog(null, "Cadastro concluido!");
registroAluno.add(aluno);
x = JOptionPane.showInputDialog(null, "Deseja voltar a tela de Login? (S/N)");
if(x.toUpperCase().equals("S")){
registroAluno.contains(aluno);
new TelaLogin().setVisible(true);
dispose();
aluno.setUsuario(txtCadastroUsuario.getText());
aluno.setSenha(txtCadastroSenha.getText());
aluno.setEmail(txtCadastroEmail.getText());
aluno.setTelefone(txtCadastroTelefone.getText());
aluno.setNome(txtCadastroNome.getText());
aluno.setDataNascimento(txtCadastrodataNascimento.getText());
aluno.setEndereco(txtCadastroEndereco.getText());
}
}
if(rbtnProfessor.isSelected()){
professor.setUsuario(txtCadastroUsuario.getText());
professor.setSenha(txtCadastroSenha.getText());
professor.setEmail(txtCadastroEmail.getText());
professor.setTelefone(txtCadastroTelefone.getText());
professor.setNome(txtCadastroNome.getText());
professor.setDataNascimento(txtCadastrodataNascimento.getText());
professor.setEndereco(txtCadastroEndereco.getText());
JOptionPane.showMessageDialog(null, "Cadastro concluido!");
registroProfessor.add(professor);
x = JOptionPane.showInputDialog(null, "Deseja voltar a tela de Login (S/N)");
if(x.toUpperCase().equals("S")){
registroProfessor.contains(professor);
new TelaLogin().setVisible(true);
dispose();
professor.setUsuario(txtCadastroUsuario.getText());
professor.setSenha(txtCadastroSenha.getText());
professor.setEmail(txtCadastroEmail.getText());
professor.setTelefone(txtCadastroTelefone.getText());
professor.setNome(txtCadastroNome.getText());
professor.setDataNascimento(txtCadastrodataNascimento.getText());
professor.setEndereco(txtCadastroEndereco.getText());
}
}
//Login
if(txtUsuario.getText().equals(aluno.getUsuario()) || txtSenha.getText().equals(aluno.getSenha())){
JOptionPane.showMessageDialog(null, "Entrando!");
new TelaAluno().setVisible(true);
dispose();
}
if(txtUsuario.getText().equals(professor.getUsuario()) || txtSenha.getText().equals(professor.getUsuario())){
JOptionPane.showMessageDialog(null, "Entrando!");
new TelaProfessor().setVisible(true);
dispose();
}
else JOptionPane.showMessageDialog(null, "Usuario ou senha inválidos!");
}