/* * 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 Login; /** * * @author kylereis */ public class Login extends javax.swing.JFrame { /** * Creates new form Login3 */ 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") // //GEN-BEGIN:initComponents private void initComponents() { jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); usernameField = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); passwordField = new javax.swing.JPasswordField(); RegisterButton = new javax.swing.JButton(); LoginButton = new javax.swing.JButton(); RecoverPassButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jLabel2.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N jLabel2.setText("CSTutor Login"); jLabel1.setText("Username:"); jLabel3.setText("Password:"); RegisterButton.setText("Register"); RegisterButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RegisterButtonActionPerformed(evt); } }); LoginButton.setText("Login"); LoginButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LoginButtonActionPerformed(evt); } }); RecoverPassButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N RecoverPassButton.setForeground(new java.awt.Color(0, 0, 255)); RecoverPassButton.setText("Forgot Password?"); RecoverPassButton.setBorder(null); RecoverPassButton.setBorderPainted(false); RecoverPassButton.setContentAreaFilled(false); RecoverPassButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RecoverPassAction(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(121, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(RegisterButton) .addGap(18, 18, 18) .addComponent(LoginButton)) .addGroup(layout.createSequentialGroup() .addGap(35, 35, 35) .addComponent(jLabel2)) .addGroup(layout.createSequentialGroup() .addGap(17, 17, 17) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(usernameField, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(RecoverPassButton)))))) .addGap(87, 87, 87)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(usernameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(RecoverPassButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(RegisterButton) .addComponent(LoginButton)) .addGap(24, 24, 24)) ); pack(); }// //GEN-END:initComponents private void LoginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoginButtonActionPerformed passwordField.setText(""); usernameField.setText(""); this.setVisible(false); // TODO add your handling code here: }//GEN-LAST:event_LoginButtonActionPerformed private void RegisterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegisterButtonActionPerformed register = new Register(); register.setVisible(true); this.setVisible(false); // TODO add your handling code here: }//GEN-LAST:event_RegisterButtonActionPerformed private void RecoverPassAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RecoverPassAction recoverPass = new RecoverPassword(); recoverPass.setVisible(true); // TODO add your handling code here: }//GEN-LAST:event_RecoverPassAction /** * @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//GEN-BEGIN:variables private javax.swing.JButton LoginButton; private javax.swing.JButton RecoverPassButton; private javax.swing.JButton RegisterButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPasswordField passwordField; private javax.swing.JTextField usernameField; // End of variables declaration//GEN-END:variables private Register register; private RecoverPassword recoverPass; }