package Boundary;
import Control.Login;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel;
public class Login_GUI extends javax.swing.JFrame {
static Login_GUI a=new Login_GUI();
public Login_GUI() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panellogin = new javax.swing.JPanel();
nombreText = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
passwordText = new javax.swing.JPasswordField();
aceptarlog = new javax.swing.JButton();
salirppg = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Equipo+Full");
panellogin.setBackground(new java.awt.Color(255, 255, 255));
panellogin.setName("Login Equipo+Full"); // NOI18N
jLabel1.setText("Nombre");
jLabel2.setText("Contraseña");
aceptarlog.setText("Aceptar");
aceptarlog.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aceptarlogActionPerformed(evt);
}
});
salirppg.setText("Salir");
salirppg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
salirppgActionPerformed(evt);
}
});
javax.swing.GroupLayout panelloginLayout = new javax.swing.GroupLayout(panellogin);
panellogin.setLayout(panelloginLayout);
panelloginLayout.setHorizontalGroup(
panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelloginLayout.createSequentialGroup()
.addGroup(panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelloginLayout.createSequentialGroup()
.addGap(64, 64, 64)
.addComponent(aceptarlog)
.addGap(34, 34, 34)
.addComponent(salirppg))
.addGroup(panelloginLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(21, 21, 21)
.addGroup(panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(nombreText)
.addComponent(passwordText, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(10, Short.MAX_VALUE))
);
panelloginLayout.setVerticalGroup(
panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelloginLayout.createSequentialGroup()
.addContainerGap(32, Short.MAX_VALUE)
.addGroup(panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(nombreText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(passwordText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(panelloginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(aceptarlog)
.addComponent(salirppg))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panellogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panellogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void aceptarlogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarlogActionPerformed
String nombre=nombreText.getText();
String pass=passwordText.getText();
Login log=new Login();
if (log.validarLogin(nombre, pass).equals("Login Valido")){
GUI.iniciar();
a.setVisible(false);
}else{
nombreText.setText("");
passwordText.setText("");
}
}//GEN-LAST:event_aceptarlogActionPerformed
private void salirppgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salirppgActionPerformed
System.exit(0);
}//GEN-LAST:event_salirppgActionPerformed
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(new SubstanceOfficeSilver2007LookAndFeel());
} catch (Exception e) {
System.out.println("Substance Graphite failed to initialize");
}
a.setVisible(true);
a.setLocationRelativeTo(null);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton aceptarlog;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField nombreText;
private javax.swing.JPanel panellogin;
private javax.swing.JPasswordField passwordText;
private javax.swing.JButton salirppg;
// End of variables declaration//GEN-END:variables
}