Boa noite!
Sou novata na programação e estou com o seguinte erro na aplicação ao chamar um jframe
Código da tela
public class TelaFormularios extends javax.swing.JFrame {
ConexaoBD conex = new ConexaoBD ();
private void preencheTabela () {
CotaDAO cotaDao = new CotaDAO ();
List listaCurso = cotaDao.getCursos();
Connection con = conex.getConexao ();
DefaultTableModel tabelaCurso = (DefaultTableModel) tableCurso.getModel ();
for (Curso c: listaCurso) {
Object [] obj = new Object [] {
c.getCodCurso(),
c.getTipo(),
c.getCodAluno()
};
tabelaCurso.addRow(obj);
}
}
public void preencheTabelaM () {
MatriculaDAO matriculaDao = new MatriculaDAO ();
List<Aluno> listaAluno = matriculaDao.getAlunos();
Connection con = conex.getConexao ();
DefaultTableModel tabelaAluno = (DefaultTableModel) tableMatricula.getModel ();
for (Aluno a: listaAluno) {
Object [] obj = new Object [] {
a.getCodAluno (),
a.getNome (),
a.getEmail(),
a.getCpf(),
a.getTelefone(),
a.getEndereco(),
a.getCodCurso(),
};
tabelaAluno.addRow(obj);
}
}
public TelaFormularios(){
initComponents();
preencheTabela ();
preencheTabelaM ();
conex.getConexao ();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
tableMatricula = new javax.swing.JTable();
jLabel3 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
tableCurso = new javax.swing.JTable();
btnSair = new javax.swing.JButton();
btnVoltar = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
jLabel1.setFont(new java.awt.Font("Berlin Sans FB Demi", 1, 24)); // NOI18N
jLabel1.setText("ANÁLISES");
getContentPane().add(jLabel1);
jLabel1.setBounds(30, 40, 103, 28);
jLabel2.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel2.setText("Alunoos/Matriculas");
getContentPane().add(jLabel2);
jLabel2.setBounds(30, 100, 151, 17);
jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
tableMatricula.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Codigo", "Nome", "Email", "Telefone", "Endereço", "Curso"
}
));
tableMatricula.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tableMatriculaMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tableMatricula);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(10, 120, 762, 150);
jLabel3.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel3.setText("Cursos/Cotas");
getContentPane().add(jLabel3);
jLabel3.setBounds(40, 300, 120, 17);
jScrollPane2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
tableCurso.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
tableCurso.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Código", "Tipo", "Matricula"
}
));
tableCurso.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tableCursoMouseClicked(evt);
}
});
jScrollPane2.setViewportView(tableCurso);
getContentPane().add(jScrollPane2);
jScrollPane2.setBounds(10, 320, 762, 240);
btnSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/iconsair.jpg"))); // NOI18N
btnSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSairActionPerformed(evt);
}
});
getContentPane().add(btnSair);
btnSair.setBounds(0, 670, 50, 50);
btnVoltar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/iconhome.jpg"))); // NOI18N
btnVoltar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnVoltarActionPerformed(evt);
}
});
getContentPane().add(btnVoltar);
btnVoltar.setBounds(60, 670, 50, 50);
jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/telas.jpg"))); // NOI18N
getContentPane().add(jLabel4);
jLabel4.setBounds(0, 0, 780, 740);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {
dispose ();
}
private void btnVoltarActionPerformed(java.awt.event.ActionEvent evt) {
TelaMenu menu = new TelaMenu ();
menu.setVisible (true);
dispose ();
}
private void tableMatriculaMouseClicked(java.awt.event.MouseEvent evt) {
preencheTabelaM ();
}
private void tableCursoMouseClicked(java.awt.event.MouseEvent evt) {
preencheTabela ();
}
/**
* @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(TelaFormularios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaFormularios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaFormularios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaFormularios.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 TelaFormularios().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnSair;
private javax.swing.JButton btnVoltar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable tableCurso;
private javax.swing.JTable tableMatricula;
// End of variables declaration
}