Пример #1
0
 private void jTable1MouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTable1MouseClicked
   int rows = jTable1.getSelectedRow();
   int col = jTable1.getSelectedColumn();
   ServiceHb helper = null;
   try {
     if (col == 2) {
       helper = new ServiceHb();
       helper.iniciarTransaccion();
       c =
           (Configuracion)
               helper.obtenerObjeto(
                   Configuracion.class,
                   Integer.parseInt(jTable1.getValueAt(rows, col).toString()));
       helper.cerrarSesion();
       c1.setText(c.getCampo());
       c2.setText(c.getDato());
     }
   } catch (Exception io) {
     JOptionPane.showMessageDialog(null, "No existe Foto");
     try {
       helper.cerrarSesion();
     } catch (Exception ios) {
     }
   }
 } // GEN-LAST:event_jTable1MouseClicked
Пример #2
0
 private void jButton2MouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jButton2MouseClicked
   try {
     if (c == null) {
       ServiceHb helper = new ServiceHb();
       helper.iniciarTransaccion();
       c = new Configuracion();
       c.setCampo(c1.getText());
       c.setDato(c2.getText());
       helper.crearObjeto(c);
       helper.confirmarTransaccion();
       helper.cerrarSesion();
     } else {
       ServiceHb helper = new ServiceHb();
       helper.iniciarTransaccion();
       c.setCampo(c1.getText());
       c.setDato(c2.getText());
       helper.actualizarObjeto(c);
       helper.confirmarTransaccion();
       helper.cerrarSesion();
     }
   } catch (Exception io) {
   }
   c1.setText(null);
   c2.setText(null);
   c = null;
   llenarreportes();
 } // GEN-LAST:event_jButton2MouseClicked
Пример #3
0
 private void jButton3MouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jButton3MouseClicked
   try {
     ServiceHb helper = new ServiceHb();
     helper.iniciarTransaccion();
     helper.eliminarObjeto(c);
     helper.confirmarTransaccion();
     helper.cerrarSesion();
     c1.setText(null);
     c2.setText(null);
     c = null;
     llenarreportes();
   } catch (Exception io) {
   }
 } // GEN-LAST:event_jButton3MouseClicked
Пример #4
0
 private void llenarreportes() {
   try {
     ServiceHb helper = new ServiceHb();
     helper.iniciarTransaccion();
     List<Configuracion> lt = helper.getConfiguracion();
     DefaultTableModel temp2 = (DefaultTableModel) jTable1.getModel();
     for (int i = temp2.getRowCount() - 1; i >= 0; i--) {
       temp2.removeRow(i);
     }
     if (lt != null) {
       for (Configuracion i : lt) {
         temp2 = (DefaultTableModel) jTable1.getModel();
         Object nuevo[] = {i.getCampo(), i.getDato(), i.getId()};
         temp2.addRow(nuevo);
       }
     }
     helper.cerrarSesion();
   } catch (Exception io) {
     System.out.println(io);
   }
 }