/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interface;
import javax.swing.JOptionPane;
/**
*
* @author hommer
*/
public class Login extends javax.swing.JFrame {
/**
* Creates new form Login
*/
public Login() {
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")
//
private void initComponents() {
Acesso = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
login = new javax.swing.JTextField();
Senha = new javax.swing.JPasswordField();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Tela de Login");
setResizable(false);
setSize(new java.awt.Dimension(0, 0));
getContentPane().setLayout(null);
Acesso.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
Acesso.setText("Entrar");
Acesso.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AcessoActionPerformed(evt);
}
});
Acesso.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
AcessoKeyPressed(evt);
}
});
getContentPane().add(Acesso);
Acesso.setBounds(570, 160, 77, 44);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Usuario:");
getContentPane().add(jLabel1);
jLabel1.setBounds(200, 122, 76, 30);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel2.setText("Senha:");
getContentPane().add(jLabel2);
jLabel2.setBounds(210, 210, 64, 30);
login.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
loginActionPerformed(evt);
}
});
login.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
loginKeyPressed(evt);
}
});
getContentPane().add(login);
login.setBounds(290, 120, 266, 32);
Senha.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SenhaActionPerformed(evt);
}
});
Senha.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
SenhaKeyPressed(evt);
}
});
getContentPane().add(Senha);
Senha.setBounds(290, 210, 265, 32);
getContentPane().add(jLabel3);
jLabel3.setBounds(-20, -20, 870, 390);
setBounds(250, 150, 866, 409);
}//
private void SenhaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void AcessoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (login.getText().equals("1")&&(Senha.getText().equals("1"))){
JOptionPane.showMessageDialog(null,"Bem Vindo");
//new Login().setVisible(true);
new TelaPrincipal().setVisible(true);
this.dispose();
}else{
JOptionPane.showMessageDialog(null,"Acesso negado");
}
//new TelaPrincipal().setVisible(true);
//this.dispose();
}
private void loginKeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode()== evt.VK_ENTER){
Senha.requestFocus();
}
}
private void loginActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void SenhaKeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode()== evt.VK_ENTER){
Acesso.requestFocus();
}
private void AcessoKeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode()== evt.VK_ENTER)
dispose();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton Acesso;
private javax.swing.JPasswordField Senha;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField login;
// End of variables declaration
private static class setVisible {
public setVisible(boolean b) {
}
}
}