private void cbxnivelesActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cbxnivelesActionPerformed try { VerDatos(); } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e.toString()); } } // GEN-LAST:event_cbxnivelesActionPerformed
private void formInternalFrameOpened( javax.swing.event.InternalFrameEvent evt) { // GEN-FIRST:event_formInternalFrameOpened dtm = (DefaultTableModel) jTable1.getModel(); try { CargarComboNiveles(); VerDatos(); HabilitarBotones(true, false, false, false); } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e.toString()); } } // GEN-LAST:event_formInternalFrameOpened
// End of variables declaration//GEN-END:variables public void VerDatos() throws ClassNotFoundException, SQLException { try { int nf = jTable1.getRowCount(); for (int i = 0; i < nf; i++) { dtm.removeRow(0); } String nivel = cbxniveles.getSelectedItem().toString(); StringTokenizer guion = new StringTokenizer(nivel, "-"); int idnivel = Integer.parseInt(guion.nextToken().toString()); for (ListaMatricula a : ADNMatricula.ListaMatriculas(idnivel)) { dtm.addRow(a.DatostoArray()); } } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e.toString()); } }
private void btneliminarActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btneliminarActionPerformed try { Matricula mat = new Matricula(); mat.setIdmatricula(FIMatricula.idalu); boolean elim = ADNMatricula.Eliminar(mat); if (elim) { JOptionPane.showMessageDialog(rootPane, "Registro eliminado"); HabilitarBotones(true, false, false, true); VerDatos(); } } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e.toString()); } } // GEN-LAST:event_btneliminarActionPerformed
private void btnmodificarActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnmodificarActionPerformed try { modif = true; FIMatricula.idmatricula = Integer.parseInt(dtm.getValueAt(jTable1.getSelectedRow(), 0).toString()); FIMatricula.idalu = Integer.parseInt(dtm.getValueAt(jTable1.getSelectedRow(), 1).toString()); FIMatricula.nomalu = dtm.getValueAt(jTable1.getSelectedRow(), 2).toString(); FIMatricula.nivel = dtm.getValueAt(jTable1.getSelectedRow(), 3).toString(); FIMatricula f = new FIMatricula(); MDI.pfondo.add(f); MDI.Centrar(MDI.pfondo, f); f.toFront(); f.setVisible(true); HabilitarBotones(true, false, false, true); } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e.toString()); } } // GEN-LAST:event_btnmodificarActionPerformed