NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.awt.Window;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

public class register extends JFrame {
private static final long serialVersionUID = 1;
private JPanel contentPane;
private JTextField firstname;
private JTextField lastname;
private JTextField email;
private JTextField username;
private JTextField mob;
private JPasswordField passwordField;
private JButton btnNewButton;
private JButton btnNewButton1;





public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
register frame = new register();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});}

public register() throws IOException {
setIconImage(Toolkit.getDefaultToolkit().getImage("C:\e.png"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(450, 90, 1014, 597);
setResizable(false);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

JLabel lblNewUserRegister = new JLabel("Register Your Account");
lblNewUserRegister.setFont(new Font("Times New Roman", Font.PLAIN, 30));
lblNewUserRegister.setBounds(362, 52, 325, 50);
contentPane.add(lblNewUserRegister);

JLabel lblName = new JLabel("First name");
lblName.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblName.setBounds(58, 152, 99, 43);
contentPane.add(lblName);

JLabel lblNewLabel = new JLabel("Last name");
lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblNewLabel.setBounds(58, 243, 110, 29);
contentPane.add(lblNewLabel);

JLabel lblEmailAddress = new JLabel("Emailrn address");
lblEmailAddress.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblEmailAddress.setBounds(58, 324, 124, 36);
contentPane.add(lblEmailAddress);

firstname = new JTextField();
firstname.setFont(new Font("Tahoma", Font.PLAIN, 32));
firstname.setBounds(214, 151, 228, 50);
contentPane.add(firstname);
firstname.setColumns(10);

lastname = new JTextField();
lastname.setFont(new Font("Tahoma", Font.PLAIN, 32));
lastname.setBounds(214, 235, 228, 50);
contentPane.add(lastname);
lastname.setColumns(10);

email = new JTextField();

email.setFont(new Font("Tahoma", Font.PLAIN, 32));
email.setBounds(214, 320, 228, 50);
contentPane.add(email);
email.setColumns(10);

username = new JTextField();
username.setFont(new Font("Tahoma", Font.PLAIN, 32));
username.setBounds(707, 151, 228, 50);
contentPane.add(username);
username.setColumns(10);

JLabel lblUsername = new JLabel("Username");
lblUsername.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblUsername.setBounds(542, 159, 99, 29);
contentPane.add(lblUsername);

JLabel lblPassword = new JLabel("Password");
lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblPassword.setBounds(542, 245, 99, 24);
contentPane.add(lblPassword);

JLabel lblMobileNumber = new JLabel("Mobile number");
lblMobileNumber.setFont(new Font("Tahoma", Font.PLAIN, 20));
lblMobileNumber.setBounds(542, 329, 139, 26);
contentPane.add(lblMobileNumber);

mob = new JTextField();
mob.setFont(new Font("Tahoma", Font.PLAIN, 32));
mob.setBounds(707, 320, 228, 50);
contentPane.add(mob);
mob.setColumns(10);

passwordField = new JPasswordField();
passwordField.setFont(new Font("Tahoma", Font.PLAIN, 32));
passwordField.setBounds(707, 235, 228, 50);
contentPane.add(passwordField);


btnNewButton = new JButton("Register");
btnNewButton1 = new JButton("Login");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String firstName = firstname.getText();
String lastName = lastname.getText();
String emailId = email.getText();
String userName = username.getText();
String mobileNumber = mob.getText();
int len = mobileNumber.length();
String password = passwordField.getText();

String msg = "" + firstName;
msg += " n";
if (len != 10) {
JOptionPane.showMessageDialog(btnNewButton, "Are you sure to create account?");
}
try {
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/megi_booking?useSSL=false&serverTimezone=UTC", "root", "root");

String query = "INSERT INTO account values('" + firstName + "','" + lastName + "','" + userName + "','" +
password + "','" + emailId + "','" + mobileNumber + "')";

Statement sta = connection.createStatement();
int x = sta.executeUpdate(query);
if (x == 0) {
JOptionPane.showMessageDialog(btnNewButton, "This is alredy exist");
} else {
JOptionPane.showMessageDialog(btnNewButton,
"Welcome, " + msg + "Your account is sucessfully created");
}
connection.close();
} catch (Exception exception) {
exception.printStackTrace();
}

int a = JOptionPane.showConfirmDialog(btnNewButton, "You are registred, do you want to login to system now?");
if (a == JOptionPane.YES_OPTION) {
dispose();
UserLogin obj = new UserLogin();
obj.setTitle("Student-Login");
obj.setVisible(true);
}
dispose();
UserLogin obj = new UserLogin();

obj.setTitle("Student-Login");
obj.setVisible(true);
}
});
btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 22));
btnNewButton.setBounds(399, 447, 259, 74);
contentPane.add(btnNewButton);

btnNewButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int a = JOptionPane.showConfirmDialog(btnNewButton, "Do you want to login to system now?");
if (a == JOptionPane.YES_OPTION) {
dispose();
UserLogin obj = new UserLogin();

obj.setVisible(true);
}
dispose();
UserLogin obj = new UserLogin();

obj.setTitle("Student-Login");
obj.setVisible(true);
}

});

btnNewButton1.setFont(new Font("Tahoma", Font.PLAIN, 22));
btnNewButton1.setBounds(239, 447, 119, 74);
contentPane.add(btnNewButton1);
}


}



     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.