Bom dia pessoal do GUJ !
tenho visto por aqui pessoas com bastante conhecimento e muita boa vontade em ajudar, por isso decidi postar minhas dúvidas:
o que acontece estou cusando a disciplina de linguagem de programação 2 de um curso técnico, que usa a linuagem java, nosso instrutor nos passou um projeto onde devemos criar 3 tipos de arquivos, 1 que contenha as classes e atributos dos objetos , 1 que contenha metodos e outra JFrames.
O projeto se baseia em criar um sistema que crie 3 objetos, Clientes, Dependentes e Funcionarios de uma locadora.Até o momento ja criei todos os objetos com classes,atributos e metodos, o problema é que não estou conseguindo inserir os metodos nos JFrames correspondentes, será que alguém com boa vontade e paciência poderia tentar ajudar um iniciante a compreender isso ?
A respeito estou trabalhando com Netbeans 6.9.1.
Abaixo os Códigos da Classe Cliente e seus Atributos:
package modelo;
import java.io.Serializable;
public class Cliente extends Pessoa implements Serializable{
public Endereco getComercial() {
return comercial;
}
public void setComercial(Endereco comercial) {
this.comercial = comercial;
}
public String getEstahAtivo() {
return estahAtivo;
}
public void setEstahAtivo(String estahAtivo) {
this.estahAtivo = estahAtivo;
}
public String getNumeroinscricao() {
return Numeroisncricao;
}
public void setNumeroinscricao(String numeroisncricao) {
this.Numeroisncricao = numeroisncricao;
}
private String Numeroisncricao = " ";
private String estahAtivo ;
private Endereco comercial;
}
Abaixo os Metodos da classe :
package controle;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.lang.String;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import javax.swing.JOptionPane;
import modelo.Cliente;
import modelo.Endereco;
import modelo.Titular;
/**
*
* @author sala302b
*/
public class ControleCLIENTE {
ArrayList listaClientes = new ArrayList();
private String numeroInscricao;
public String getNumeroinscricao;
public void incluirCliente(String nome, String rua ,String complemento,String bairro,
String cidade ,String estado, String cep ,String pais , String sexo,
String email,String celular , String comercial, String res ,String data,
String cpf , String inscricao, String ativo) throws IOException {
Cliente cliente = new Cliente();
cliente.setNome(nome);
cliente.setSexo(sexo);
cliente.setDtNascimento(data);
cliente.setEstahAtivo(ativo);
cliente.setNumeroinscricao(inscricao);
cliente.setEmail(email);
Endereco residencial = new Endereco();
residencial.setBairro(bairro);
residencial.setRua(rua);
residencial.setCidade(cidade);
residencial.setComplemento(complemento);
residencial.setCep(cep);
residencial.setPais(pais);
residencial.setEstado(estado);
Titular titular = new Titular();
titular.setTelefoneComercial(comercial);
titular.setTelefoneCelular(celular);
titular.setTelefoneResidencial(res);
titular.setCpf(cpf);
listaClientes.add(cliente);
}
public Cliente pesquisar (String nome)
{
for(int x = 0;x < listaClientes.size();x++){
Cliente cliente = (Cliente) listaClientes.get(x);
Collections.sort(listaClientes);
if(cliente.getNome().contains(nome))
return cliente;
}
return null;
}
public Cliente excluir(String nome){
for(int x = 0;x < listaClientes.size();x++){
Cliente cliente = (Cliente) listaClientes.get(x);
if(cliente.getNome().contains(nome))
listaClientes.remove(cliente);
}
return null;
}
}
Abaixo o Jframe onde devo inserir os metodos : (ai que começa meu problema)
package visao;
import controle.ControleCLIENTE;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author sala302b
*/
public class Cliente extends javax.swing.JFrame {
private static class listaClientes {
private static int size() {
throw new UnsupportedOperationException("Not yet implemented");
}
public listaClientes() {
}
}
ControleCLIENTE cliente;
/** Creates new form Cliente */
public Cliente() {
initComponents();
setLocationRelativeTo(null);
}
public Cliente(ControleCLIENTE cliente) {
initComponents();
setLocationRelativeTo(null);
this.cliente = cliente;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
buttonGroup3 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
nome = new javax.swing.JTextField();
sexo1 = new javax.swing.JRadioButton();
sexo2 = new javax.swing.JRadioButton();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
rua = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
cidade = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
estado = new javax.swing.JComboBox();
jLabel7 = new javax.swing.JLabel();
bairro = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
complemento = new javax.swing.JTextField();
pais = new javax.swing.JComboBox();
jLabel15 = new javax.swing.JLabel();
incluir = new javax.swing.JButton();
excluir = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
email = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
ativo = new javax.swing.JRadioButton();
inativo = new javax.swing.JRadioButton();
cpf = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
celular = new javax.swing.JTextField();
jLabel14 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
comercial = new javax.swing.JTextField();
jLabel17 = new javax.swing.JLabel();
residencial = new javax.swing.JTextField();
cep = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
data = new javax.swing.JTextField();
jLabel18 = new javax.swing.JLabel();
sim = new javax.swing.JRadioButton();
nao = new javax.swing.JRadioButton();
consultar = new javax.swing.JButton();
jLabel19 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("CLIENTES");
setResizable(false);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cadastro de Clientes", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 255))); // NOI18N
jPanel1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jPanel1KeyPressed(evt);
}
});
jLabel1.setText("Nome :");
nome.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nomeActionPerformed(evt);
}
});
nome.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
nomeKeyPressed(evt);
}
public void keyReleased(java.awt.event.KeyEvent evt) {
nomeKeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
nomeKeyTyped(evt);
}
});
buttonGroup2.add(sexo1);
sexo1.setText("Masc.");
sexo1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sexo1ActionPerformed(evt);
}
});
buttonGroup2.add(sexo2);
sexo2.setText("Fem.");
jLabel2.setText("Sexo :");
jLabel4.setText("Endereço :");
rua.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ruaActionPerformed(evt);
}
});
jLabel5.setText("Cidade :");
cidade.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cidadeActionPerformed(evt);
}
});
jLabel6.setText("UF ");
estado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RN", "RS", "RJ", "RO", "RR", "SC", "SP", "SE", "TO", " " }));
estado.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
estadoActionPerformed(evt);
}
});
jLabel7.setText("Bairro :");
bairro.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bairroActionPerformed(evt);
}
});
jLabel8.setText("Complemento :");
jLabel9.setText("Cep :");
codigo.setText(String.valueOf(System.currentTimeMillis()).substring(6,10));
codigo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
codigoActionPerformed(evt);
}
});
jLabel10.setText("Nº Inscrição :");
complemento.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
complementoActionPerformed(evt);
}
});
pais.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "Afeganistão", "África do Sul", "Akrotiri", "Albânia", "Alemanha", "Andorra", "Angola", "Anguila", "Antárctida", "Antígua e Barbuda", "Antilhas Neerlandesas", "Arábia Saudita", "Arctic Ocean", "Argélia", "Argentina", "Arménia", "Aruba", "Ashmore and Cartier Islands", "Atlantic Ocean", "Austrália", "Áustria", "Azerbaijão", "Baamas", "Bangladeche", "Barbados", "Barém", "Bélgica", "Belize", "Benim", "Bermudas", "Bielorrússia", "Birmânia", "Bolívia", "Bósnia e Herzegovina", "Botsuana", "Brasil", "Brunei", "Bulgária", "Burquina Faso", "Burúndi", "Butão", "Cabo Verde", "Camarões", "Camboja", "Canadá", "Catar", "Cazaquistão", "Chade", "Chile", "China", "Chipre", "Clipperton Island", "Colômbia", "Comores", "Congo-Brazzaville", "Congo-Kinshasa", "Coral Sea Islands", "Coreia do Norte", "Coreia do Sul", "Costa do Marfim", "Costa Rica", "Croácia", "Cuba", "Dhekelia", "Dinamarca", "Domínica", "Egipto", "Emiratos Árabes Unidos", "Equador", "Eritreia", "Eslováquia", "Eslovénia", "Espanha", "Estados Unidos", "Estónia", "Etiópia", "Faroé", "Fiji", "Filipinas", "Finlândia", "França", "Gabão", "Gâmbia", "Gana", "Gaza Strip", "Geórgia", "Geórgia do Sul e Sandwich do Sul", "Gibraltar", "Granada", "Grécia", "Gronelândia", "Guame", "Guatemala", "Guernsey", "Guiana", "Guiné", "Guiné Equatorial", "Guiné-Bissau", "Haiti", "Honduras", "Hong Kong", "Hungria", "Iémen", "Ilha Bouvet", "Ilha do Natal", "Ilha Norfolk", "Ilhas Caimão", "Ilhas Cook", "Ilhas dos Cocos", "Ilhas Falkland", "Ilhas Heard e McDonald", "Ilhas Marshall", "Ilhas Salomão", "Ilhas Turcas e Caicos", "Ilhas Virgens Americanas", "Ilhas Virgens Britânicas", "Índia", "Indian Ocean", "Indonésia", "Irão", "Iraque", "Irlanda", "Islândia", "Israel", "Itália", "Jamaica", "Jan Mayen", "Japão", "Jersey", "Jibuti", "Jordânia", "Kuwait", "Laos", "Lesoto", "Letónia", "Líbano", "Libéria", "Líbia", "Listenstaine", "Lituânia", "Luxemburgo", "Macau", "Macedónia", "Madagáscar", "Malásia", "Malávi", "Maldivas", "Mali", "Malta", "Man, Isle of", "Marianas do Norte", "Marrocos", "Maurícia", "Mauritânia", "Mayotte", "México", "Micronésia", "Moçambique", "Moldávia", "Mónaco", "Mongólia", "Monserrate", "Montenegro", "Mundo", "Namíbia", "Nauru", "Navassa Island", "Nepal", "Nicarágua", "Níger", "Nigéria", "Niue", "Noruega", "Nova Caledónia", "Nova Zelândia", "Omã", "Pacific Ocean", "Países Baixos", "Palau", "Panamá", "Papua-Nova Guiné", "Paquistão", "Paracel Islands", "Paraguai", "Peru", "Pitcairn", "Polinésia Francesa", "Polónia", "Porto Rico", "Portugal", "Quénia", "Quirguizistão", "Quiribáti", "Reino Unido", "República Centro-Africana", "República Checa", "República Dominicana", "Roménia", "Ruanda", "Rússia", "Salvador", "Samoa", "Samoa Americana", "Santa Helena", "Santa Lúcia", "São Cristóvão e Neves", "São Marinho", "São Pedro e Miquelon", "São Tomé e Príncipe", "São Vicente e Granadinas", "Sara Ocidental", "Seicheles", "Senegal", "Serra Leoa", "Sérvia", "Singapura", "Síria", "Somália", "Southern Ocean", "Spratly Islands", "Sri Lanca", "Suazilândia", "Sudão", "Suécia", "Suíça", "Suriname", "Svalbard e Jan Mayen", "Tailândia", "Taiwan", "Tajiquistão", "Tanzânia", "Território Britânico do Oceano Índico", "Territórios Austrais Franceses", "Timor Leste", "Togo", "Tokelau", "Tonga", "Trindade e Tobago", "Tunísia", "Turquemenistão", "Turquia", "Tuvalu", "Ucrânia", "Uganda", "União Europeia", "Uruguai", "Usbequistão", "Vanuatu", "Vaticano", "Venezuela", "Vietname", "Wake Island", "Wallis e Futuna", "West Bank", "Zâmbia", "Zimbabué ", " " }));
pais.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
paisActionPerformed(evt);
}
});
jLabel15.setText("Pais");
incluir.setText("Incluir");
incluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
incluirActionPerformed(evt);
}
});
excluir.setText("Excluir");
excluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
excluirActionPerformed(evt);
}
});
jButton3.setText("Alterar");
jButton5.setText("Menu");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
email.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
emailActionPerformed(evt);
}
});
jLabel3.setText("E-mail :");
jLabel11.setText("Situação");
buttonGroup1.add(ativo);
ativo.setText("Ativo");
ativo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ativoActionPerformed(evt);
}
});
ativo.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
ativoKeyPressed(evt);
}
});
buttonGroup1.add(inativo);
inativo.setText("Inativo");
inativo.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
inativoKeyPressed(evt);
}
});
javax.swing.text.MaskFormatter format_textField5 = null;
try{
format_textField5 = new javax.swing.text.MaskFormatter("###.###.###-##");
}catch(Exception ex){
ex.printStackTrace();
}
cpf = new javax.swing.JFormattedTextField(format_textField5);
cpf.setHorizontalAlignment(javax.swing.JTextField.CENTER);
cpf.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cpfActionPerformed(evt);
}
});
jLabel12.setText("Cpf :");
javax.swing.text.MaskFormatter format_textField1 = null;
try{
format_textField1 = new javax.swing.text.MaskFormatter("(##)####-####");
}catch(Exception ex){
ex.printStackTrace();
}
celular = new javax.swing.JFormattedTextField(format_textField1);
celular.setHorizontalAlignment(javax.swing.JTextField.CENTER);
celular.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
celularActionPerformed(evt);
}
});
jLabel14.setText("Tel. Res.:");
jLabel16.setText("Tel. Comer.:");
javax.swing.text.MaskFormatter format_textField3 = null;
try{
format_textField3 = new javax.swing.text.MaskFormatter("(##)####-####");
}catch(Exception ex){
ex.printStackTrace();
}
comercial = new javax.swing.JFormattedTextField(format_textField3);
comercial.setHorizontalAlignment(javax.swing.JTextField.CENTER);
comercial.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comercialActionPerformed(evt);
}
});
jLabel17.setText("Celular :");
javax.swing.text.MaskFormatter format_textField2 = null;
try{
format_textField2 = new javax.swing.text.MaskFormatter("(##)####-####");
}catch(Exception ex){
ex.printStackTrace();
}
residencial = new javax.swing.JFormattedTextField(format_textField2);
residencial.setHorizontalAlignment(javax.swing.JTextField.CENTER);
residencial.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
residencialActionPerformed(evt);
}
});
javax.swing.text.MaskFormatter format_textField = null;
try{
format_textField = new javax.swing.text.MaskFormatter("##-###-###");
}catch(Exception ex){
ex.printStackTrace();
}
cep = new javax.swing.JFormattedTextField(format_textField);
cep.setHorizontalAlignment(javax.swing.JTextField.CENTER);
cep.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cepActionPerformed(evt);
}
});
jLabel13.setText("Data de Nasc.");
javax.swing.text.MaskFormatter format_textField4 = null;
try{
format_textField4 = new javax.swing.text.MaskFormatter("##/##/####");
}catch(Exception ex){
ex.printStackTrace();
}
data = new javax.swing.JFormattedTextField(format_textField4);
data.setHorizontalAlignment(javax.swing.JTextField.CENTER);
data.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dataActionPerformed(evt);
}
});
jLabel18.setText("Dependentes :");
buttonGroup3.add(sim);
sim.setText("Sim");
sim.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
simActionPerformed(evt);
}
});
buttonGroup2.add(nao);
nao.setText("Não");
consultar.setText("Consultar");
consultar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
consultarActionPerformed(evt);
}
});
jLabel19.setFont(new java.awt.Font("Tahoma", 1, 12));
jLabel19.setText("TITULAR");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(incluir)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(excluir)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(consultar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10)
.addComponent(jLabel12)
.addComponent(jLabel1)
.addComponent(jLabel4)
.addComponent(jLabel8)
.addComponent(jLabel7)
.addComponent(jLabel5)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel9)
.addComponent(jLabel11)
.addComponent(jLabel14)
.addComponent(jLabel17))
.addGap(24, 24, 24)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(ativo)
.addGap(18, 18, 18)
.addComponent(inativo))
.addComponent(bairro, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(sexo1)
.addGap(18, 18, 18)
.addComponent(sexo2))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cep)
.addComponent(cidade, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(57, 57, 57)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pais, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(nome, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rua, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(complemento, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(email, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(celular, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cpf, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(residencial, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel13)
.addComponent(jLabel16))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comercial, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(data, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel18)
.addGap(18, 18, 18)
.addComponent(sim)
.addGap(18, 18, 18)
.addComponent(nao)))))))
.addComponent(jLabel19))
.addContainerGap(39, Short.MAX_VALUE))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comercial, data});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(7, 7, 7)
.addComponent(jLabel19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8)
.addComponent(complemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(bairro, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel15)
.addComponent(pais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(cep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(sexo2)
.addComponent(sexo1)
.addComponent(jLabel2))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(celular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16)
.addComponent(comercial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel17))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(residencial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14)
.addComponent(jLabel13)
.addComponent(data, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10)
.addComponent(sim)
.addComponent(nao)
.addComponent(jLabel18))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ativo)
.addComponent(inativo)
.addComponent(jLabel11))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(incluir)
.addComponent(excluir)
.addComponent(jButton3)
.addComponent(consultar)
.addComponent(jButton5))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comercial, data});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void nomeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void sexo1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void ruaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void cidadeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void bairroActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void codigoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void complementoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void incluirActionPerformed(java.awt.event.ActionEvent evt) {
if(nome.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Nome Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
nome.requestFocus();
return;}
if(rua.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Endereço Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
rua.requestFocus();
return;}
if(bairro.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Bairro Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
bairro.requestFocus();
return;}
if(cidade.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo cidade Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
cidade.requestFocus();
return;}
if(cep.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo CEp Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
cep.requestFocus();
return;}
if(email.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo E-mail Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
email.requestFocus();
return;}
if(celular.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Tel Residencial Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
celular.requestFocus();
return;}
if(data.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Data de Nasc. Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
data.requestFocus();
return;}
if(cpf.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Cpf Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
cpf.requestFocus();
return;}
if(codigo.getText().trim().equals("")){
JOptionPane.showMessageDialog(null,"Campo Número de Inscrição Obrigatorio", "ERRO",JOptionPane.ERROR_MESSAGE);
codigo.requestFocus();
return;}
else{
try {
String sexoEscolhido = "";
if(sexo1.isEnabled()){
sexoEscolhido = "Masc";
}else {
sexoEscolhido = "Fem";
}
String situacaoEscolhida = "";
if (ativo.isSelected()){
situacaoEscolhida = "Ativo";
}
else if(inativo.isSelected()) {
situacaoEscolhida = "Inativo";
}
cliente.incluirCliente(nome.getText(),rua.getText(),complemento.getText(), bairro.getText(), cidade.getText(), estado.getSelectedItem().toString(), cep.getText(), pais.getSelectedItem().toString(),sexoEscolhido, email.getText(), celular.getText(),comercial.getText(), residencial.getText(),data.getText(), cpf.getText(), codigo.getText(),situacaoEscolhida );
} catch (IOException ex) {
Logger.getLogger(Cliente.class.getName()).log(Level.SEVERE, null, ex);
}
JOptionPane.showMessageDialog(null,"Dados Salvos com sucesso ", "Informação",JOptionPane.INFORMATION_MESSAGE);
}
nome.setText("");
rua.setText("");
complemento.setText("");
bairro.setText("");
cidade.setText("");
cep.setText("");
email.setText("");
comercial.setText("");
residencial.setText("");
celular.setText("");
data.setText("");
cpf.setText("");
estado.setSelectedIndex(0);
pais.setSelectedIndex(0);
if (sexo1.isSelected() || sexo2.isSelected())
buttonGroup2.clearSelection();
if (ativo.isSelected() || inativo.isSelected())
buttonGroup1.clearSelection();
if (sim.isSelected() || nao.isSelected())
buttonGroup3.clearSelection();
codigo.setText("");
nome.requestFocus();
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
Cliente.this.dispose();// TODO add your handling code here:
}
private void emailActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void ativoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void cpfActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void celularActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void comercialActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void residencialActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void estadoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void excluirActionPerformed(java.awt.event.ActionEvent evt) {
// Excluir frame9 = new Excluir(this.cliente);
// frame9.setVisible(true);
// this.cliente.excluirCliente(10);
}
private void cepActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void dataActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void paisActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void simActionPerformed(java.awt.event.ActionEvent evt) {
if (sim.isSelected()){
Dependente frame3 = new Dependente ();
frame3.setVisible(true);
if (sim.isSelected() || nao.isSelected())
buttonGroup3.clearSelection();
}
}
private void consultarActionPerformed(java.awt.event.ActionEvent evt) {
// Pesquisar frame5 = new Pesquisar();
// frame5.setVisible(true);
}
private void nomeKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
private void nomeKeyReleased(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
private void nomeKeyTyped(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
private void jPanel1KeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
private void ativoKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
private void inativoKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Cliente().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JRadioButton ativo;
private javax.swing.JTextField bairro;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.JTextField celular;
private javax.swing.JTextField cep;
private javax.swing.JTextField cidade;
private javax.swing.JTextField codigo;
private javax.swing.JTextField comercial;
private javax.swing.JTextField complemento;
private javax.swing.JButton consultar;
private javax.swing.JTextField cpf;
private javax.swing.JTextField data;
private javax.swing.JTextField email;
private javax.swing.JComboBox estado;
private javax.swing.JButton excluir;
private javax.swing.JRadioButton inativo;
private javax.swing.JButton incluir;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JRadioButton nao;
private javax.swing.JTextField nome;
private javax.swing.JComboBox pais;
private javax.swing.JTextField residencial;
private javax.swing.JTextField rua;
private javax.swing.JRadioButton sexo1;
private javax.swing.JRadioButton sexo2;
private javax.swing.JRadioButton sim;
// End of variables declaration
}
Espero que ossam compreender o problema e se possivel me ajudar .