adplus-dvertising
Coders Packet

Programming language JAVA Title: Registration Page

By Rayven Santosh Thakur

JAVA Registration Page Using Swing Controls & XAMPP Server Database. Create A Registration Page with Swing Controls & Store Information in the Database.

In this blog, we will see how to create A Registration page in Java Swing Controls. 

So, For this Registration Page, You will require the following tools,

NetBeans IDE

XAMPP Control

 

(Above Both tools are free and openly accessible, You can download it and Install it in your System)

 

Step 1: Create New Database on Xampp Server

1. Go to http://localhost/phpmyadmin/ (After Properly installing the xampp server in your system)

2. Go to New Database (Located At Left-Hand side of PhpMyAdmin Screen) 

3. Give Desire Database Name also Select Default Collation which is located at beside the database name.

4. Give the desire Table Name and the Desire number of columns & then click on Go.

5.In this Step you Need to give a column name that will be you adding to your Registration page. For Ex. Name, Address, Etc. 

(Add Proper Name for Database References, Add a type of your Column like INT, VARCHAR, Etc, & Add Length/Values of Column.

These Three Columns are Compulsory to fill or else you won't go to the Next Step) CLICK ON SAVE.

\\ You are Done With your Table.

 

Step 2: Create Front-End Design For Your Registration Page.

1.Open NetBeans

2.Click On New Project

3.Select Java Application

4.Give Desire Project Name

5. Add New JFrame Form

6.Add Label, TextField, Button From Swing Controls. (You can choose different controls as per your requirements).

7. Change Variable Name of jTextField. (Optional)

8.Add Button For SUBMIT.

9.Now Run Your Project and Check All the Layout Of Registration Page. (Optional)

\\You are Done With your Front End Coding.

 

Step 3: Back End Code For Registation Page.

1. Go to Source

2. Add Packages as follows

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import javax.swing.*;

3. Add Interface Statement

public class Registration extends javax.swing.JFrame {

 

Connection con = null;

PreparedStatement pst = null;

 

4. Go to private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) & Add This Following Code.

try

{

 

String Query="INSERT INTO `registration`(`Fname`, `Lname`, `Mname`, `Email`, `Address`) VALUES (?,?,?,?,?)";

 

 

con = DriverManager.getConnection("jdbc:mysql://localhost/codespeedy","root","");

 

 

 

pst = con.prepareStatement(Query);

pst.setString(1, Fname.getText());

pst.setString(2, Lname.getText());

pst.setString(3, Mname.getText());

pst.setString(4, Email.getText());

pst.setString(5, Address.getText());

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"SUCCESSFULLY REGISTER");

 

catch(Exception e)

{

JOptionPane.showMessageDialog(null," REGISTER FAILED");

}

}

 

Step 4: Add Jar Files in Test Libraries

1.Add MySQL-connector-java-8.0.22. jar file 

(You can download the jar file on the internet)

Step 5: Run & Debug

Step 6: See the Output

 

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Rayven Santosh Thakur (rayventhakur52)

Download packets of source code on Coders Packet