ta ai a parte onde chamo a tabela, como posso fazer o que você falou?
Desde já agradeço…
[code]public PainelInferiorCliente() throws SQLException {
// Definindo que as configurações serão manuais
this.setLayout(null);
// Definindo tmanho da tela
this.setSize(600, 600);
this.setBackground(Color.LIGHT_GRAY);
try {
tc = new ClienteTableModel(dao);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JTable t = new JTable(tc);
scroll = new JScrollPane(t);
scroll.setBounds(70, 305, 470, 100);
scroll.setVisible(true);
this.add(scroll);
id = new JLabel("Código : ");
id.setBounds(70, 110, 100, 20);
id.setVisible(true);
this.add(id);
campoID = new JTextArea();
campoID.setBounds(120, 110, 30, 20);
campoID.setVisible(true);
campoID.setEnabled(false);
this.add(campoID);
localizar = new JButton("Localizar");
localizar.setBounds(160, 110, 150, 20);
localizar.setVisible(true);
this.add(localizar);
localizar.addActionListener(this);
cpf = new JLabel("Cpf : ");
cpf.setBounds(70, 130, 100, 20);
cpf.setVisible(true);
this.add(cpf);
campoCpf = new JTextArea();
campoCpf.setBounds(70, 155, 100, 20);
campoCpf.setVisible(true);
this.add(campoCpf);
nome = new JLabel("Nome : ");
nome.setBounds(180, 130, 100, 20);
nome.setVisible(true);
this.add(nome);
campoNome = new JTextArea();
campoNome.setBounds(180, 155, 360, 20);
campoNome.setVisible(true);
this.add(campoNome);
endereco = new JLabel("Endereço : ");
endereco.setBounds(70, 180, 100, 20);
endereco.setVisible(true);
this.add(endereco);
campoEndereco = new JTextArea();
campoEndereco.setBounds(70, 205, 310, 20);
campoEndereco.setVisible(true);
this.add(campoEndereco);
numero = new JLabel("Número : ");
numero.setBounds(390, 180, 100, 20);
numero.setVisible(true);
this.add(numero);
campoNumero = new JTextArea();
campoNumero.setBounds(390, 205, 150, 20);
campoNumero.setVisible(true);
this.add(campoNumero);
bairro = new JLabel("Bairro : ");
bairro.setBounds(70, 230, 100, 20);
bairro.setVisible(true);
this.add(bairro);
campoBairro = new JTextArea();
campoBairro.setBounds(70, 255, 150, 20);
campoBairro.setVisible(true);
this.add(campoBairro);
cep = new JLabel("Cep : ");
cep.setBounds(230, 230, 100, 20);
cep.setVisible(true);
this.add(cep);
campoCep = new JTextArea();
campoCep.setBounds(230, 255, 150, 20);
campoCep.setVisible(true);
this.add(campoCep);
telefone = new JLabel("Telefone : ");
telefone.setBounds(390, 230, 100, 20);
telefone.setVisible(true);
this.add(telefone);
campoTelefone = new JTextArea();
campoTelefone.setBounds(390, 255, 150, 20);
campoTelefone.setVisible(true);
this.add(campoTelefone);
salvar = new JButton("Cadastrar");
salvar.setBounds(70, 280, 150, 20);
salvar.setVisible(true);
this.add(salvar);
salvar.addActionListener(this);
excluir = new JButton("Excluir");
excluir.setBounds(230, 280, 150, 20);
excluir.setVisible(true);
this.add(excluir);
excluir.addActionListener(this);
alterar = new JButton("Alterar");
alterar.setBounds(390, 280, 150, 20);
alterar.setVisible(true);
this.add(alterar);
alterar.addActionListener(this);
// Deixar painel visível
this.setVisible(true);
}
public void habilitaCampo() {
campoNome.setEnabled(false);
campoCpf.setEnabled(false);
campoEndereco.setEnabled(false);
campoNumero.setEnabled(false);
campoBairro.setEnabled(false);
campoCep.setEnabled(false);
campoTelefone.setEnabled(false);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(salvar)) {
cliente1.setNome(campoNome.getText());
cliente1.setCpf(campoCpf.getText());
cliente1.setEndereco(campoEndereco.getText());
cliente1.setNumero(campoNumero.getText());
cliente1.setBairro(campoBairro.getText());
cliente1.setTelefone(campoTelefone.getText());
campoID.setText(String.valueOf(dao.insereBanco(cliente1)));
tc.addCliente(cliente1);
}
}
}
[/code]