/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* TelaInicial.java
*
* Created on 27/11/2011, 18:52:19
*/
package GUI;
import DAL.Conexao;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
*
* @author Vanessa
*/
public class TelaInicial extends javax.swing.JPanel {
private String _nomeJogador;
private String _senhaJogador;
private String _nomePartida;
Conexao cx = new Conexao();
TelaDoJogador tj = new TelaDoJogador();
/** Creates new form TelaInicial */
public TelaInicial() {
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">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
caixaTextoUsuario = new javax.swing.JTextField();
caixaTextoSenha = new javax.swing.JPasswordField();
jLabel3 = new javax.swing.JLabel();
setLayout(null);
jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18));
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("USUĂRIO");
add(jLabel1);
jLabel1.setBounds(40, 240, 83, 22);
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 18));
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("SENHA");
add(jLabel2);
jLabel2.setBounds(40, 270, 61, 22);
jButton1.setText("ENTRAR");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
add(jButton1);
jButton1.setBounds(280, 250, 120, 23);
jButton2.setText("CADASTRAR");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
add(jButton2);
jButton2.setBounds(430, 250, 120, 23);
add(caixaTextoUsuario);
caixaTextoUsuario.setBounds(140, 240, 111, 20);
add(caixaTextoSenha);
caixaTextoSenha.setBounds(140, 270, 110, 20);
jLabel3.setIcon(new javax.swing.ImageIcon("I:\\PI\\2012\\build\\Imagens\\2012.jpg")); // NOI18N
add(jLabel3);
jLabel3.setBounds(0, 0, 620, 520);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
setNomeJogador(this.caixaTextoUsuario.getText());
setSenhaJogador(this.caixaTextoSenha.getText());
tj.setNomeJogador(_nomeJogador);
if(cx.existeJogador(_nomeJogador)){
if(cx.senhaCorreta(_senhaJogador, _nomeJogador)){
JFrame jf = new JFrame();
jf.setSize(588, 555);
jf.setContentPane(tj);
jf.show();
}
else
JOptionPane.showMessageDialog(null, "Usuario ou senha incorreto");
}
else{
JOptionPane.showMessageDialog(null, "Usuario ou senha incorreto");
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
TelaCadastro tc = new TelaCadastro();
JFrame jf = new JFrame();
jf.setSize(588, 555);
jf.setContentPane(tc);
jf.show();
}//GEN-LAST:event_jButton2ActionPerformed
public String getNomeJogador(){
return _nomeJogador;
}
public String getSenhaJogador(){
return _senhaJogador;
}
public String getNomePartida(){
return _nomePartida;
}
public void setNomeJogador(String nomeJogador){
this._nomeJogador = nomeJogador;
}
public void setSenhaJogador(String senha){
this._senhaJogador = senha;
}
public void setNomePartida(String nomePartida){
this._nomePartida = nomePartida;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPasswordField caixaTextoSenha;
private javax.swing.JTextField caixaTextoUsuario;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
// End of variables declaration//GEN-END:variables
}