O código abaixo apresenta erros?
package Formularios;
import Dao.ContatoDao;
import Logica.Contato;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Júnior
*/
public class AgendaContatos extends javax.swing.JFrame {
DefaultTableModel tnContato = new DefaultTableModel(null, new String[]{"Nome", "Endereco", "Telefone", "Email", "Sexo"});
List<Contato> contatos;
ListSelectionModel lsncontato;
public AgendaContatos() {
initComponents();
//desabilitado();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton6 = new javax.swing.JButton();
jFormattedTextField1 = new javax.swing.JFormattedTextField();
jPanel1 = new javax.swing.JPanel();
jLnome = new javax.swing.JLabel();
jLendereco = new javax.swing.JLabel();
jLtelefone = new javax.swing.JLabel();
jLemail = new javax.swing.JLabel();
jLsexo = new javax.swing.JLabel();
jTnome = new javax.swing.JTextField();
jTendereco = new javax.swing.JTextField();
jTtelefone = new javax.swing.JTextField();
jTemail = new javax.swing.JTextField();
jTsexo = new javax.swing.JTextField();
jBpesquisa = new javax.swing.JButton();
jTpesquisa = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
jTtabela = new javax.swing.JTable();
jPanel2 = new javax.swing.JPanel();
jBnovo = new javax.swing.JButton();
jBalterar = new javax.swing.JButton();
jBexcluir = new javax.swing.JButton();
jBsalvar = new javax.swing.JButton();
jBsair = new javax.swing.JButton();
jButton6.setText("jButton6");
jFormattedTextField1.setText("jFormattedTextField1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados do Contato"));
jLnome.setText("Nome:");
jLendereco.setText("Endereço:");
jLtelefone.setText("Telefone:");
jLemail.setText("Email:");
jLsexo.setText("Sexo:");
jTendereco.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTenderecoActionPerformed(evt);
}
});
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()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLendereco)
.addComponent(jLnome))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTnome)
.addComponent(jTendereco)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLsexo, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLemail, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLtelefone, javax.swing.GroupLayout.Alignment.LEADING))
.addGap(21, 21, 21)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTemail)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTsexo, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(jTtelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLnome)
.addComponent(jTnome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLendereco)
.addComponent(jTendereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLtelefone)
.addComponent(jTtelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLemail)
.addComponent(jTemail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLsexo)
.addComponent(jTsexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jBpesquisa.setText("Pesquisa");
jBpesquisa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBpesquisaActionPerformed(evt);
}
});
jTtabela.setBackground(new java.awt.Color(100, 100, 100));
jTtabela.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTtabela);
jBnovo.setText("Novo");
jBnovo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBnovoActionPerformed(evt);
}
});
jBalterar.setText("Alterar");
jBexcluir.setText("Excluir");
jBsalvar.setText("Salvar");
jBsalvar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBsalvarActionPerformed(evt);
}
});
jBsair.setText("Sair");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jBnovo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jBalterar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jBexcluir)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jBsalvar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jBsair)
.addContainerGap(17, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBnovo)
.addComponent(jBalterar)
.addComponent(jBexcluir)
.addComponent(jBsalvar)
.addComponent(jBsair))
.addContainerGap(20, Short.MAX_VALUE))
);
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jTpesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49)
.addComponent(jBpesquisa))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBpesquisa)
.addComponent(jTpesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>
private void jTenderecoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jBnovoActionPerformed(java.awt.event.ActionEvent evt) {
habilitado();
jTnome.setText("");
jTendereco.setText("");
jTtelefone.setText("");
jTemail.setText("");
jTsexo.setText("");
}
public boolean verificaDados() {
if (jTnome.getText().equals("")
&& jTendereco.getText().equals("")
&& jTtelefone.getText().equals("")
&& jTemail.getText().equals("")
&& jTsexo.getText().equals("")) {
return true;
}
return false;
}
public void desabilitado() {
jTnome.setEditable(false);
jTendereco.setEditable(false);
jTtelefone.setEditable(false);
jTemail.setEditable(false);
jTsexo.setEditable(false);
}
public void habilitado() {
jTnome.setEditable(true);
jTendereco.setEditable(true);
jTtelefone.setEditable(true);
jTemail.setEditable(true);
jTsexo.setEditable(true);
}
private void jBsalvarActionPerformed(java.awt.event.ActionEvent evt) {
// cadastro();
// habilitado();
try {
Contato c1 = new Contato();
c1.setNome(jTnome.getText());
c1.setEndereco(jTendereco.getText());
c1.setTelefone(jTtelefone.getText());
c1.setEmail(jTemail.getText());
c1.setSexo(jTsexo.getText());
ContatoDao daoo = new ContatoDao();
daoo.adciona(c1);
} catch (SQLException ex) {
Logger.getLogger(AgendaContatos.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void jBpesquisaActionPerformed(java.awt.event.ActionEvent evt) {
try {
listarContatos();
} catch (SQLException ex) {
Logger.getLogger(AgendaContatos.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void listarContatos() throws SQLException {
ContatoDao daoo = new ContatoDao();
contatos = daoo.getList("%" + jTpesquisa.getText() + "%");
mostraPesquisa(contatos);
}
public void cadastro() {
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new AgendaContatos().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jBalterar;
private javax.swing.JButton jBexcluir;
private javax.swing.JButton jBnovo;
private javax.swing.JButton jBpesquisa;
private javax.swing.JButton jBsair;
private javax.swing.JButton jBsalvar;
private javax.swing.JButton jButton6;
private javax.swing.JFormattedTextField jFormattedTextField1;
private javax.swing.JLabel jLemail;
private javax.swing.JLabel jLendereco;
private javax.swing.JLabel jLnome;
private javax.swing.JLabel jLsexo;
private javax.swing.JLabel jLtelefone;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTemail;
private javax.swing.JTextField jTendereco;
private javax.swing.JTextField jTnome;
private javax.swing.JTextField jTpesquisa;
private javax.swing.JTextField jTsexo;
private javax.swing.JTable jTtabela;
private javax.swing.JTextField jTtelefone;
// End of variables declaration
private void mostraPesquisa(List<Contato> contato) {
if (contatos.size() == 0) {
JOptionPane.showMessageDialog(null, "Nenhum contato encontrado no banco!!");
}else{
String[] linha = new String [] {null, null, null, null, null, null};
for (int i = 0; i > contatos.size(); i++) {
tnContato.addRow(linha);
tnContato.setValueAt(contato.get(i).getNome(), i, 1);
tnContato.setValueAt(contato.get(i).getEndereco(), i, 2);
tnContato.setValueAt(contato.get(i).getTelefone(), i, 3);
tnContato.setValueAt(contato.get(i).getEmail(), i, 4);
System.out.println(tnContato);
}
}
}
}
E ESSE É O SEGUINTE ERRO QUE DA EM SEGUIDA.