Desculpe o erro, na proxima lembrarei da exception. vlw
Obrigado pela ajuda.
Segue a minha classe de login completa.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* TelaLogin.java
*
* Created on 10/10/2009, 18:40:13
*/
package login.view;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import login.bean.LoginBean;
import login.dao.LoginDao;
import login.facade.LoginFacade;
import login.utilidades.SistemaException;
import produto.view.QuadroPrincipal;
/**
*
* @author info
*/
public class TelaLogin extends javax.swing.JFrame {
/** Creates new form TelaLogin */
public TelaLogin() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jEditorPane1 = new javax.swing.JEditorPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jBEntrar = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jTFId = new javax.swing.JTextField();
jPFSenha = new javax.swing.JPasswordField();
jLabel3 = new javax.swing.JLabel();
jScrollPane1.setViewportView(jEditorPane1);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Id:");
jLabel2.setText("Senha:");
jBEntrar.setText("Entrar");
jBEntrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBEntrarActionPerformed(evt);
}
});
jButton2.setText("Fechar");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jTFId.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTFIdActionPerformed(evt);
}
});
jPFSenha.setText("jPasswordField1");
jPFSenha.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jPFSenhaMouseClicked(evt);
}
});
jPFSenha.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jPFSenhaActionPerformed(evt);
}
});
jLabel3.setText("Informe o Id e a senha cadastrados para entrar");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPFSenha)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jBEntrar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTFId)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(58, 58, 58)
.addComponent(jLabel3)))
.addContainerGap(125, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addGap(54, 54, 54)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTFId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPFSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 105, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBEntrar)
.addComponent(jButton2))
.addGap(47, 47, 47))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
private void jTFIdActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jPFSenhaActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jBEntrarActionPerformed(java.awt.event.ActionEvent evt) {
LoginBean lb = new LoginBean();
LoginBean lb1 = new LoginBean();
LoginDao ld = new LoginDao();
lb1.setId(jTFId.getText());
lb1.setSenha(jPFSenha.getText());
LoginFacade lf = new LoginFacade();
try {
lb = (LoginBean) lf.login(lb1);
if ((lb.getSenha().equals(lb1.getSenha())) && lb.getId().equals(lb1.getId()) ){
JOptionPane.showMessageDialog(null, "Bem vindo!"+lb1.getId());
new QuadroPrincipal().setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Usuário ou Senha \n incorretos!", "Proibido o acesso!", 1);
}
} catch (SistemaException ex) {
Logger.getLogger(TelaLogin.class.getName()).log(Level.SEVERE, null, ex);
}
/* try {
lb = (LoginBean) lf.login(lb1);
if ( /*lb.getSenha().equals(lb1.getSenha()) & lb.getId().equals(lb1.getId()) ) {
dispose();
new QuadroPrincipal().setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Usuário ou Senha \n incorretos!", "Proibido o acesso!", 1);
}
} catch (SistemaException ex) {
Logger.getLogger(TelaLogin.class.getName()).log(Level.SEVERE, null, ex);
}
*/
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
dispose();
}
private void jPFSenhaMouseClicked(java.awt.event.MouseEvent evt) {
jPFSenha.setText("");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaLogin().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jBEntrar;
private javax.swing.JButton jButton2;
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPasswordField jPFSenha;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTFId;
// End of variables declaration
}
[b] Eu já mexi em tudo. o JTFId era um jTextField que coloquei esse nome pra facilitar. JÁ coloquei um action performed nele assim como na minha classe de login antiga que funcionqa.
Todos os atributos, tanto o login quanto a senha estão sendo preenchidos.
Deve ser alguma idiotice. vlw