Advertisement
Metziop

Hilo crono

May 22nd, 2021
844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {                                        
  2.  
  3.         this.btnStart.setEnabled(false);
  4.         this.btnStop.setEnabled(true);
  5.         int fila = jtAsignaciones.getSelectedRow();
  6.         String idTrabajo = jtAsignaciones.getValueAt(fila, 0).toString();
  7.         String tiempoEstimado = jtAsignaciones.getValueAt(fila, 2).toString();
  8.  
  9.         //----------------parte sql--------------------//
  10.         try {
  11.  
  12.             String querry = "UPDATE pedidosempleado SET horaInicio=?, estatus=? WHERE idPedidoEmpleado=?";
  13.             String estatus = "en elaboracion";
  14.             Connection conn = MySQLConection.getConnection();
  15.             PreparedStatement ps = conn.prepareStatement(querry);
  16.             ps.setTime(1, Time.valueOf(LocalTime.now()));
  17.             ps.setString(2, estatus);
  18.             ps.setString(3, idTrabajo);
  19.             ps.executeUpdate();
  20.  
  21.         } catch (Exception e) {
  22.             JOptionPane.showMessageDialog(null, "error" + e);
  23.         }
  24.         //----------------llamando al hilo--------------------//
  25.         cronometro crono = new cronometro(00, 00, 00);
  26.         tiempo = new Thread(crono);
  27.         crono.addObserver(this);
  28.         tiempo.start();
  29.  
  30.     }                      
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement