private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
        String user = UsernameText.getText();
        String pass = new String(PasswordText.getPassword());
        if (!user.equals("") && !pass.equals("")) {
            String q = "select contrasenna from usuario where nombre_usuario = '" + user + "';";
            try {
                ResultSet ejecutarConsulta = connection.ejecutarConsulta(q);
                if (ejecutarConsulta.next()) {
                    if (ejecutarConsulta.getString(1).equals(pass)) {
                        this.correct = true;
                        this.username = user;
                        java.io.File userfile = new File("user");
                        if (checkRememberUsername.isSelected()) {
                            java.io.FileWriter fw = new FileWriter(userfile);
                            fw.write(user);
                            fw.close();
                            java.io.File passfile = new File("pass");
                            if (checkRememberPassword.isEnabled()) {
                                fw = new FileWriter(passfile);
                                fw.write(pass);
                                fw.close();
                            } else {
                                passfile.delete();
                            }
                        } else {
                            userfile.delete();
                        }
                        this.setVisible(false);
                        this.dispose();
                    } else {
                        ShowError("Contraseña incorrecta");
                    }
                } else {
                    ShowError("El usuario no existe");
                }
            } catch (SQLException sqlEX) {
                ShowError("Imposible establecer la conexión con la base de datos");
                System.out.println(q);
            } catch (IOException ioex) {
            }
        } else {
            ShowError("El nombre de usuario o contraseña está vacío");
        }
    }//GEN-LAST:event_OkButtonActionPerformed