ERRO Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""

Estou com um erro a horas numa aplicação que estou fazendo…
Alguem poderia dar-me uma luz?

Os códigos:
public class CotaDAO {

 private Connection conn;
 private ConexaoBD conexao;

public CotaDAO () {
    this.conexao = new ConexaoBD ();
    this.conn = this.conexao.getConexao ();
}

 public void cadastrar (Curso curso) {
 
    String sql = "INSERT INTO curso (codCurso Tipo, codAluno) VALUES "
            + "(?,?,?,?)"; 
   
    try {
        PreparedStatement stmt = this.conn.prepareStatement(sql);
        stmt.setInt    (1, curso.getCodCurso());
        stmt.setString (2, curso.getTipo());
        stmt.setInt    (3, curso.getCodAluno());
  
        stmt.execute ();
        stmt.close();
        
       System.out.println ("Cadastrado com sucesso!");
        
    } catch (Exception ex) {
       System.out.println ( "Erro ao cadastrar-se" + ex);
    }
}  

public List <Curso> getCursos () {
    
   String sql = "SELECT * FROM curso" ; 
   
   try {
       PreparedStatement stmt = this.conn.prepareStatement(sql);
       ResultSet rs = stmt.executeQuery();
       List<Curso> listaCurso = new ArrayList<> ();
       // percorre o rs e salva as informações dentro de uma variavel curso,
       // e depois salva essa variavel dentro da lista
       while (rs.next()) {
           Curso curso  = new Curso ();
           curso.setCodCurso(rs.getInt("codCurso"));
           curso.setTipo(rs.getString("Tipo"));
           curso.setCodAluno(rs.getInt ("codAluno"));
           
      listaCurso.add(curso);
      
       }
  return listaCurso;
  
   } catch (Exception ex) {
        System.out.println ( "Erro ao buscar" + ex);
   }
     return null;
}

}

para o botão:

private void btnCadastroCursoActionPerformed(java.awt.event.ActionEvent evt) {

  int codCurso =  Integer.parseInt(txtCodigoCurso.getText ().trim());
  String tipo = boxTipoCurso.getSelectedItem().toString();
  int codAluno =  Integer.parseInt(campoMatriculaAluno.getText().trim());
  
  Curso curso = new Curso ();
  curso.setCodCurso(codAluno);
  curso.setTipo(tipo);
  curso.setCodAluno(codAluno);
  
  CotaDAO cotaDao = new CotaDAO ();
  cotaDao.cadastrar(curso);
 
}

O erro deve estar em uma dessas linhas acima. campoMatriculaAluno e/ou txtCodigoCurso devem estar vazios, o que provoca esse erro.

O melhor é antes de fazer a conversão, vc testar se o campo está preenchido e se possui um número válido.

Obrigado! consegui resolver o problema!
aproveitando o tópico estou com outro erro nessa minha mesma aplicação, ao clicar num botao para abrir o formulário de registros do banco, me aparece o seguinte erro:

sabes como tratar?

o código da tela Formulários cujo o erro está aparecendo

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                   

}