private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                                                                

    // Cadastra o usuário
    
    String nome = jTextField1.getText();
    String email = jTextField2.getText();
    String senha = String.copyValueOf(jPasswordField1.getPassword());
    boolean ok = true;
    
    if (String.copyValueOf(jPasswordField2.getPassword()).isEmpty()) {
        jPasswordField2.setBackground(Color.red);
        jPasswordField2.grabFocus();
        ok = false;
    }
    
    if (senha.isEmpty()) {
        jPasswordField1.setBackground(Color.red);
        jPasswordField1.grabFocus();
        ok = false;
    }

    if (email.isEmpty()) {
        jTextField2.setBackground(Color.red);
        jTextField2.grabFocus();
        ok = false;
    }
    
    if (nome.isEmpty()) {
        jTextField1.setBackground(Color.red);
        jTextField1.grabFocus();
        ok = false;
    }
    
    jLabel8.setVisible(!ok);
    
    if (ok && emailOK && senhaOK) {
        BusinessFactory factory = BusinessFactory.getInstance();
        UsuarioVO user = new UsuarioVO(); 
        user.setNome(nome);
        user.setEmail(email);
        user.setSenha(senha);
        try {
            factory.getUsuario().create(user);
            MainWindow.getInstance().closeCurrentCard(user);
        } catch (BusinessException ex) {
            Logger.getLogger(JPCadastrarUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}