Tenho a tela de cadastro e um código java onde está minhas variáveis, mas quando salvo na tela de cadastro não tem valor nenhum dentro da variável como se não tivesse salvo, acredito eu que não esteja mesmo salvando
TelaCadastro:
private void buttonSalvar(java.awt.event.ActionEvent evt) {
Cadastro cad = new Cadastro();
if (tf_nomecliente.getText().equals("")
|| tf_endereco.getText().equals("")
|| tf_rg.getText().equals("")
|| tf_cpf.getText().equals("")
|| tf_tel.getText().equals("")
|| tf_tipo.getText().equals ("")
|| tf_raca.getText().equals ("")) {
JOptionPane.showMessageDialog(null, "Campo em branco. \n Preencha todos os campos.");
}
else {
new Visualizar().setVisible(true);
cad.setNome(tf_nomecliente.getText());
cad.setEndereco(tf_endereco.getText());
cad.setCpf(Integer.parseInt(tf_cpf.getText()));
cad.setRg(Integer.parseInt(tf_rg.getText()));
cad.setTelefone(Integer.parseInt(tf_tel.getText()));
}
}
Cadastro.java:
public class Cadastro {
private int id;
private String nome;
private int telefone;
private int rg;
private int cpf;
private String endereco;
}
Tem todo o get e set feito no Cadastro.java


