Hobbies CV
Hobbies CV
import java.awt.Color;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.swing.JOptionPane;
/**
*
* @author MEET
*/
public class Login_register_screen_new extends javax.swing.JFrame {
/**
* Creates new form Login_register_screen
*/
public Login_register_screen_new() {
initComponents();
this.setLocationRelativeTo(null);
registerPanel.setVisible(false);
signUpInPanel.setVisible(false);
LoginPanel.setVisible(false);
changePasswordPanel.setVisible(false);
adminPanel.setVisible(false);
selectGuestAdmin.setVisible(true);
selectGuestAdmin.setLocation(380, 70);
EmailTF.setBackground(new Color(0, 0, 0, 0));
UsernameTF.setBackground(new Color(0, 0, 0, 0));
/**
* 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.setText("jLabel1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(1420, 799));
setResizable(false);
getContentPane().setLayout(null);
selectGuestAdmin.setMaximumSize(new java.awt.Dimension(491,
760));
selectGuestAdmin.setMinimumSize(new java.awt.Dimension(491,
760));
selectGuestAdmin.setOpaque(false);
selectGuestAdminLayout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.LEADING)
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGroup(selectGuestAdminLayout.createParallelGroup(javax.swing.GroupLay
out.Alignment.LEADING)
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(jSeparator11,
javax.swing.GroupLayout.PREFERRED_SIZE, 415,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(jSeparator25,
javax.swing.GroupLayout.PREFERRED_SIZE, 415,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGap(125, 125, 125)
.addComponent(admin,
javax.swing.GroupLayout.PREFERRED_SIZE, 237,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGap(120, 120, 120)
.addComponent(guest,
javax.swing.GroupLayout.PREFERRED_SIZE, 236,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGap(118, 118, 118)
.addComponent(user,
javax.swing.GroupLayout.PREFERRED_SIZE, 235,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(46, 46, 46))
);
selectGuestAdminLayout.setVerticalGroup(
selectGuestAdminLayout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.LEADING)
.addGroup(selectGuestAdminLayout.createSequentialGroup()
.addGap(58, 58, 58)
.addComponent(user,
javax.swing.GroupLayout.PREFERRED_SIZE, 40,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(67, 67, 67)
.addComponent(jSeparator11,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(71, 71, 71)
.addComponent(guest,
javax.swing.GroupLayout.PREFERRED_SIZE, 40,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(77, 77, 77)
.addComponent(jSeparator25,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(59, 59, 59)
.addComponent(admin,
javax.swing.GroupLayout.PREFERRED_SIZE, 40,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(304, Short.MAX_VALUE))
);
getContentPane().add(selectGuestAdmin);
selectGuestAdmin.setBounds(0, 0, 491, 760);
jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel18.setText("Admin");
jLabel18.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(255, 102, 0)));
adminPanel.add(jLabel18, new
org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, 154, 40));
jLabel21.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel21.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel21.setForeground(java.awt.SystemColor.control);
jLabel21.setText("Admin Id");
adminPanel.add(jLabel21, new
org.netbeans.lib.awtextra.AbsoluteConstraints(80, 230, 149, -1));
jLabel24.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel24.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel24.setForeground(java.awt.SystemColor.control);
jLabel24.setText("Password");
adminPanel.add(jLabel24, new
org.netbeans.lib.awtextra.AbsoluteConstraints(80, 310, 149, -1));
jLabel9.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/left-arrow
(1).png"))); // NOI18N
jLabel9.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel9MouseClicked(evt);
}
});
adminPanel.add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 30, 40));
getContentPane().add(adminPanel);
adminPanel.setBounds(760, 110, 490, 662);
signUpInPanel.setBackground(getBackground());
signUpInPanel.setMaximumSize(new java.awt.Dimension(491, 730));
signUpInPanel.setMinimumSize(new java.awt.Dimension(491, 730));
signUpInPanel.setOpaque(false);
signUpInPanel.setPreferredSize(new java.awt.Dimension(491, 730));
signUpInPanel.setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jButton8.setBorder(javax.swing.BorderFactory.createEtchedBorder(java.awt.
Color.white, null));
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
signUpInPanel.add(jButton8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(150, 370, 170, -1));
jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel14.setText("Don't have an account ?");
signUpInPanel.add(jLabel14, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 120, 260, 40));
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel8.setText("Or");
signUpInPanel.add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(210, 310, 50, -1));
jLabel11.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/left-arrow
(1).png"))); // NOI18N
jLabel11.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel11MouseClicked(evt);
}
});
signUpInPanel.add(jLabel11, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 30, 40));
getContentPane().add(signUpInPanel);
signUpInPanel.setBounds(-40, 90, 450, 700);
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel15.setText("Login");
jLabel15.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(255, 102, 0)));
LoginPanel.add(jLabel15, new
org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, 154, 40));
jLabel16.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel16.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel16.setForeground(java.awt.SystemColor.control);
jLabel16.setText("Email");
LoginPanel.add(jLabel16, new
org.netbeans.lib.awtextra.AbsoluteConstraints(80, 230, 149, -1));
jLabel17.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel17.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel17.setForeground(java.awt.SystemColor.control);
jLabel17.setText("Password");
LoginPanel.add(jLabel17, new
org.netbeans.lib.awtextra.AbsoluteConstraints(80, 310, 149, -1));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("Forgot password ?");
jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel4MouseClicked(evt);
}
});
LoginPanel.add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(100, 430, 260, -1));
jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel19.setText("Create account");
jLabel19.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel19MouseClicked(evt);
}
});
LoginPanel.add(jLabel19, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 610, 200, -1));
getContentPane().add(LoginPanel);
LoginPanel.setBounds(760, 110, 490, 662);
changePasswordPanel.setMaximumSize(new java.awt.Dimension(491,
760));
changePasswordPanel.setMinimumSize(new java.awt.Dimension(491,
760));
changePasswordPanel.setOpaque(false);
changePasswordPanel.setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel20.setText("Change Password");
jLabel20.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(255, 102, 0)));
changePasswordPanel.add(jLabel20, new
org.netbeans.lib.awtextra.AbsoluteConstraints(70, 50, 320, 40));
jLabel22.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel22.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel22.setForeground(java.awt.SystemColor.control);
jLabel22.setText("Confirm Password");
changePasswordPanel.add(jLabel22, new
org.netbeans.lib.awtextra.AbsoluteConstraints(90, 320, 218, -1));
jLabel23.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel23.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel23.setForeground(java.awt.SystemColor.control);
jLabel23.setText("New Password");
changePasswordPanel.add(jLabel23, new
org.netbeans.lib.awtextra.AbsoluteConstraints(90, 240, 210, -1));
getContentPane().add(changePasswordPanel);
changePasswordPanel.setBounds(490, 10, 445, 586);
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel10.setText("Register");
jLabel10.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(255, 102, 0)));
registerPanel.add(jLabel10);
jLabel10.setBounds(110, 50, 219, 40);
jLabel6.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel6.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel6.setForeground(java.awt.SystemColor.control);
jLabel6.setText("Email");
registerPanel.add(jLabel6);
jLabel6.setBounds(90, 280, 149, 30);
jLabel2.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel2.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel2.setForeground(java.awt.SystemColor.control);
jLabel2.setText("Confirm Password");
registerPanel.add(jLabel2);
jLabel2.setBounds(90, 440, 218, 30);
jLabel7.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel7.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel7.setForeground(java.awt.SystemColor.control);
jLabel7.setText("Password");
registerPanel.add(jLabel7);
jLabel7.setBounds(90, 360, 149, 30);
jLabel5.setBackground(java.awt.SystemColor.activeCaptionText);
jLabel5.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
jLabel5.setForeground(java.awt.SystemColor.control);
jLabel5.setText("Username");
registerPanel.add(jLabel5);
jLabel5.setBounds(90, 200, 149, 30);
jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel12.setText("Already have an account ?");
jLabel12.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel12MouseClicked(evt);
}
});
registerPanel.add(jLabel12);
jLabel12.setBounds(100, 650, 270, 40);
getContentPane().add(registerPanel);
registerPanel.setBounds(70, 20, 490, 720);
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/mylogin_back.png"))
); // NOI18N
getContentPane().add(jLabel3);
jLabel3.setBounds(0, 0, 1420, 800);
pack();
}// </editor-fold>//GEN-END:initComponents
Class.forName("com.mysql.jdbc.Driver");
conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/cv_resume_builde
r", "root", "mayank");
stmt = conn.createStatement();
if (rs.next() == true) {
JOptionPane.showMessageDialog(this, "Email-ID
already exist.", "ERROR !", JOptionPane.ERROR_MESSAGE);
} else if (rs.next() == false) {
try {
{
try {
String host = "smtp.gmail.com";
String user =
"[email protected]";
String pass = "meetmayank";
// String emailid = null;
// String to =
"[email protected]";
String to = email;
String from =
"[email protected]";
String subject = "Registration
Successful :) ";
String messageText = "Hi
"+uname+"!\n\n\nWelcome to CV Builder!\nYour Registration is Successful
in CV builder.\nNow start to build your CV or Resume.\nYou can find your
Job and cheers !\n\n\nThanks!\nCV Builder Team.";
boolean sessionDebug = false;
Properties props =
System.getProperties();
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", "587");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.required", "true");
java.security.Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());
Session mailSession =
Session.getDefaultInstance(props, null);
mailSession.setDebug(sessionDebug);
Message msg = new
MimeMessage(mailSession);
msg.setFrom(new
InternetAddress(from));
InternetAddress[] address1 = {new
InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address1);
msg.setSubject(subject);
msg.setSentDate(new
java.util.Date());
msg.setText(messageText);
Transport transport =
mailSession.getTransport("smtp");
transport.connect(host, user, pass);
transport.sendMessage(msg,
msg.getAllRecipients());
transport.close();
System.out.println("message send
successfully");
} catch (Exception e) {
System.out.println("Exception caught
--> " + e);
}
}
stmt.executeUpdate("INSERT INTO
`register`(`UserId`, `UserName`, `Email`, `Password`,`profile`) VALUES
(NULL,'" + uname + "','" + email + "','" + Pass + "',NULL);");
JOptionPane.showMessageDialog(this,
"Successfully Registered...", "Success",
JOptionPane.INFORMATION_MESSAGE);
registerPanel.setVisible(false);
LoginPanel.setVisible(true);
LoginPanel.setLocation(380, 55);
} catch (Exception e) {
//JOptionPane.showMessageDialog(this, "Email-
ID already whyexist.", "ERROR !", JOptionPane.ERROR_MESSAGE);
}
}
conn.close();
} catch (Exception e) {
System.out.println(e);
}
}
} else if (Pass.length() != 0 && CPass.length() != 0) {
JOptionPane.showMessageDialog(this, "Password and Confirm
Password aren't matched.", "ERROR...!", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_SignUpButtonActionPerformed
private void
ConfirmPasswordTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_ConfirmPasswordTFActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ConfirmPasswordTFActionPerformed
LoginPanel.setVisible(true);
LoginPanel.setLocation(380, 55);
registerPanel.setVisible(false);
signUpInPanel.setVisible(false);
}//GEN-LAST:event_jButton8ActionPerformed
registerPanel.setVisible(true);
registerPanel.setLocation(380, 55);
LoginPanel.setVisible(false);
signUpInPanel.setVisible(false);
}//GEN-LAST:event_jButton7ActionPerformed
private void EmailLoginTFActionPerformed(java.awt.event.ActionEvent
evt) {//GEN-FIRST:event_EmailLoginTFActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_EmailLoginTFActionPerformed
Class.forName("com.mysql.jdbc.Driver");
conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/cv_resume_builde
r", "root", "mayank");
stmt = conn.createStatement();
if (rs.next() == true) {
JOptionPane.showMessageDialog(this, "Successfully
Logged...!", "Success", JOptionPane.INFORMATION_MESSAGE);
EmailLoginTF.setText("");
PasswordLogin.setText("");
ChooseScreen c = new
ChooseScreen(rs.getInt("UserId"));
this.setVisible(false);
c.setVisible(true);
} else if (rs.next() == false) {
JOptionPane.showMessageDialog(this, "Something
went wrong...", "ERROR !", JOptionPane.ERROR_MESSAGE);
PasswordLogin.setText("");
}
conn.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
}//GEN-LAST:event_jButton5ActionPerformed
}//GEN-LAST:event_jLabel19MouseClicked
try {
Class.forName("com.mysql.jdbc.Driver");
conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/cv_resume_builde
r", "root", "mayank");
stmt = conn.createStatement();
if(result == 1){
JOptionPane.showMessageDialog(this, "Your Password
changed successfully !", "Change Password",
JOptionPane.INFORMATION_MESSAGE);
LoginPanel.setVisible(true);
LoginPanel.setLocation(380, 55);
changePasswordPanel.setVisible(false);
}else{
JOptionPane.showMessageDialog(this, "ERROR
ocurred...! Please try again.", "Change Password",
JOptionPane.INFORMATION_MESSAGE);
}
conn.close();
} catch (Exception e) {
System.out.println(e);
}//GEN-LAST:event_jButton6ActionPerformed
private void
confirmChangePwdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_confirmChangePwdActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_confirmChangePwdActionPerformed
}//GEN-LAST:event_jTextField7ActionPerformed
}//GEN-LAST:event_userMouseClicked
}//GEN-LAST:event_adminMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws InterruptedException {
Start_welcome_screen s = new Start_welcome_screen();
s.setVisible(true);
Thread t = Thread.currentThread();
t.sleep(3000);
s.setVisible(false);
s.dispose();
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel
setting code (optional) ">
/* 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 ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login_register_screen_new.class.getNam
e()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login_register_screen_new.class.getNam
e()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login_register_screen_new.class.getNam
e()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login_register_screen_new.class.getNam
e()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>