private void jBttnCadastrarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Cliente c = new Cliente();
c.setNome(clienteNome.getText());
c.setSexo(RadioButtonMasculino.getText());
c.setSexo(RadioButtonFeminino.getText());
c.setRg(clienteRg.getText());
c.setCpf(clienteCpf.getText());
c.setEndereco(clienteEndereco.getText());
if (clienteNome.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Nome em branco.");
clienteNome.requestFocus();
return;
} else {
if (clienteRg.getText().equals("") ) {
JOptionPane.showMessageDialog(null, "Rg em branco!");
clienteRg.requestFocus();
return;
} else {
if (clienteCpf.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Cpf em branco!");
clienteCpf.requestFocus();
return;
} else {
if (clienteEndereco.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Endereço em branco!");
clienteEndereco.requestFocus();
return;
}
if (RadioButtonMasculino.isSelected()){
RadioButtonMasculino.requestFocus();
}
if (RadioButtonFeminino.isSelected()){
RadioButtonFeminino.requestFocus();
}
}
}
try {
fachada.salvar(c);
clienteNome.setText("");
RadioButtonMasculino.setText("masculino");
RadioButtonFeminino.setText("feminino");
clienteRg.setText("");
clienteCpf.setText("");
clienteEndereco.setText("");
JOptionPane.showMessageDialog(null, "Cliente cadastrado com sucesso!");
clienteNome.requestFocus();
} catch (GeralException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
dispose();
}
private void RadioButtonMasculinoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void RadioButtonFemininoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void clienteEnderecoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(JFCadastroCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(JFCadastroCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(JFCadastroCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(JFCadastroCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFCadastroCliente().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JRadioButton RadioButtonFeminino;
private javax.swing.JRadioButton RadioButtonMasculino;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.ButtonGroup buttonGroup4;
private javax.swing.ButtonGroup buttonGroup5;
private javax.swing.JFormattedTextField clienteCpf;
private javax.swing.JTextField clienteEndereco;
private javax.swing.JTextField clienteNome;
private javax.swing.JFormattedTextField clienteRg;
private javax.swing.JButton jBttnCadastrar;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
// End of variables declaration
}
Bom turma tou com essa duvida aqui ver so quero colocar a opção para sexo no radiobutton mais nao tou conserguindo de nenhuma forma tb pq nao sei como implementar
peço que vcs olhe esse codico e vejam onde eu tou errando pf obg.