private void przyciskzalogujsieActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_przyciskzalogujsieActionPerformed
   String datazal = sprawdzdate();
   String nazwa = login.getSelectedItem().toString();
   String haslo = password.getText();
   try {
     ResultSet pobHaslo =
         stmt.executeQuery("select * from PRACOWNICY where login like '" + nazwa + "'");
     while (pobHaslo.next()) {
       String popr = pobHaslo.getString("haslo");
       if (haslo.equals(popr)) {
         stmt3 = con.createStatement();
         stmt4 = con.createStatement();
         rs =
             stmt4.executeQuery(
                 "select * from LOGOWANIE where id_log=(select max(id_log) from LOGOWANIE)");
         while (rs.next()) {
           String sesja = rs.getString("DATA_GODZ_W");
           if (sesja.equals("sesja trwa")) {
             stmt5 = con.createStatement();
             stmt5.executeUpdate(
                 "update LOGOWANIE set DATA_GODZ_W='"
                     + datazal
                     + "' where id_log=(select max(id_log) from LOGOWANIE)");
           }
         }
         String log =
             "insert into LOGOWANIE values ((select count(*)FROM LOGOWANIE)+1,(select id_prac from PRACOWNICY where login like '"
                 + nazwa
                 + "'),'"
                 + datazal
                 + "','sesja trwa')";
         stmt3.executeUpdate(log);
         Zamowienia zam = new Zamowienia();
         zam.setLocationRelativeTo(null);
         zam.setVisible(true);
         dispose();
       } else {
         komunikat.setText("Podane hasło jest niepoprawne.");
       }
     }
   } catch (SQLException ex) {
     JOptionPane.showMessageDialog(null, "Brak połączenia z bazą danych");
   }
 } // GEN-LAST:event_przyciskzalogujsieActionPerformed
 private void powrotActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_powrotActionPerformed
   zam.setVisible(true);
   dispose();
 } // GEN-LAST:event_powrotActionPerformed