Java Swing Registration Form with MySQL Database in Eclipse

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys in this video I want to implement registration form using Java swing JDBC my sequel example tutorial so this tutorial I have already created published on my website and I will be providing link of this tutorial in a video descriptions for your reference so in this tutorial we will learn how to implement registration form using Java swing confidence with database connectivity and here we are using the API to connect to the MySQL database and we use my super database to store the user register data alright so here are the two Santa Claus that we'll be using so you GDK 1.8 or later and we will be using Mexico Connect Java driver so we are going to use Mexico database so we need to have a JDBC driver for that right so we are using Mexico connect a delivery driver and we use JDBC API that is 4.2 this is the latest ELISA JDBC yay and we are going to use Eclipse IDE to develop this application okay so look at there what we are building is we are building a simple Java swing application with a resistor creation form and which told the registration data into my secure database you look at here this is the screen and this is the basically of a window and here we have a labels and text fields and button alright so first name last name email address a username password and mobile numbers for these are the labels and here are the text fields we basically enter a data into a text field and here is the button and this is also a label so we are going to design the screen using swing components alright so first we need to have a database setup so first we create our swing underscore demo database in a my sequel or database server and next we create account people okay so let's go and let's open my sequel workbench to connect to the my Sequoia data server alright so I'm in Mexico workbench and let me create a database so so just to open this tutorial I hope link up this tutorial in a video description so that you can just copy these statements okay so let me copy this statement to create a database so look at here the database does not exist so so let's look at this database here so here we go so a database is created let me refresh ya swing and rotate demo database is created now let me create a account table okay so let us copy this DDL script and here I'm going to exhibit this script so before that let me select US database I have in X with this statement yeah here we go so table is created let me refresh I click refresh all and here we go so account table is created under swing underscore demo database Wow our database setup is ready alright so now let us see the next step so now we create a simple Java project in Eclipse IDE and we download my sequel connector JDBC driver and we add this driver to the class path apology our project and then we create application to implement or to develop a registration form all right so let's switch to the Eclipse IDE and let us create a java application so I'm in Eclipse IDE so in order to create a application Java project just go to the file new Java project and just give a project thing as swing registration example 8 finish yeah here we go so swing resolution example is created now what we'll do is we'll just download a my sequel connector delivery driver so just you know Google just type my sequel can come live in dependency and go to the Marvin repository here and just pick up the latest that leads up my secure connectors he lives driver and here we have two options we can download the jar file our you can copy them Marvin dependency so if you are using my own project then you can just copy the Marvin dependency or if you are using integrated project then you can just copy the gradual dependency so we are using a simple project so let me just download the jar file so just I click on it it will download or dependency on your file system like this okay so let me add this dependency to the project class path so I can go to the Eclipse and write right click on the project build up configure build path and click on add external jobs and look at here - the connector driver jar dependency is added to the class path and here you can you know edit the JDK or agre okay hit apply apply and close now we have added you know my sequel connectors really which driver dependence it was a project class path all right now our setup is ready now let's go ahead and let's write the program so before that let me create a package in structure so just give a package name as net got Java X dot swing okay so now let's create a class and let's name it as a user registration right click on the package new and class and just type our user registration as a class then now let me copy this product so instead of typing line by line code what I will do I will just reuse this code and I will explaining this code okay so that we can save the timeline we can complete this tutorial as soon as possible so that we can say our time so this is the screen we are developing right so let me donate a screen with the core so that you will understand easy so user education is a class which extends jframe so Geoffrey M is digested it extends of frame component and it provides you no extra component architecture support so we can use a default implementation of energy frame all right and you'll get here as I mentioned we are going to create a label text fields buttons all right so for that we need to declare here the components for example we're going to create content panel and we are going to create a text field that is for first name text field for last name text field for a more user name and mobile and we are going to create a password so we are going to create a password text field so for that we need to declare the password field here and we are going to create a button so look at here the resistor button so we need to declare the register button so these are the components we are going to use to develop the screen okay so this is the constructor within a constructor we are going to write the code so look at here the set icon image okay so this is the method which we can use to display an icon for the window okay this is a close button so once we click on this close button or a close icon then the j will terminates the swing application or a swing program okay and here we just set the bounds this is the height and aware tiny the x and y so if you can go to its implementation so look at here the X Y width and height okay so just we provide all these parameters in order to no sighs our window and we create a panel here and we provide the border for the panel and we set the panel to the center content panel okay and we have we're using default a layout so that you can just patch final here and look at here the screen so new user register so this is the label right so for this we need to write a code like this so label is fetch findable name here and specify a point for the label and specify the width and height for the label and and just add this label to the family like this okay so now we have created new user registered label all right so let's word and let's create our other labels like first name last name email address etc so for the first name the steps are same we first create a label object and we pass the label name here like we provide a font and then the width and height and we add this label to the phenyl and for last name also the same so we create a label with last name as a label name and we provide a font name height and each time you need to add this label to the panel and for email address also the same steps we get a table object and we specify label name here and we provide upon tyne the height and width and we add this label to the panel okay so now we have created a first name last name and email address labels okay so now let's get a text fields for these labels so for that we need to use a text field company to create a text field so I just created that jtextfield object and just add a font here and heighten of it and add this text field to the panel and here specify a columns as a 10 here okay so this is for host name and let's I'm gonna do it for the last name so we just created a jtextfield object and we specify a font height width and we add our last name text field to the panel here similarly do it for email okay so pretty simple and similarly do it for username and now we create a user label and password and mobile ok so now we have created user name password and mobile labels and let's create a text field for the same so here we create our text field for mobile and password alright so I hope you understood so we just create a label and we create a text field for the label that's it the steps are same now we have created all the labels and text fields now let's create a resistor button so in order to get a resistor version we use a J button component or a class so just create a J button install sign just passed the resistor as a button name and look at here I No okay so once we click on a resistor button it really will perform some action like so for that we need to add action listener interface and once we click on the register button it will I know a resistor it will store all the resistor data into a database okay so that logic we need to write here this is a action listener interface and just we are providing implementation here and this interface provides action for Foreman method I mean here we are going to implement this method so what we are doing is this is a first name so this is the text we write so that we have created here okay and whenever we enter some data into these text fields we can get this data by using and get text method okay and we store it in a first name and similarly for last name we get a last name text field data by using the add text fill method and we store it in the last name and similarly for abilities using a mobile number okay and we get a length of mobile number here and similarly we get a password text field data and we store in a password variable okay okay so look at here if the mobile number is not equal to 10 so basically mobile number the length of the mobile number is 10 so it is not 10 then we show a message like enter a valid mobile number okay and here we are going to connect to the Massaquoi database using 0 Hz a PA or if we look at here we are using get connection method to connect to the master database and driver manager will provide a gate connection method to establish a connection with my super database and here we are providing JDBC URL using our password and look at your swingin underscore demo is the name of the database okay and this is the insert SQL statement and account is the table name and we are going to store all the registration data into account table pretty simple right and here once we got a connection object then we can create a statement object by using create statement method and we observed this statement object using exhibit update method and we just passed the I know query here so this will execute this query and it will return the number of Records inserted into the database if the recorder are 0 then we say that the record is already exist and if the record is greater than 0 then we say that our user account is successfully created and we close the connection that's it's pretty simple program swing program which performs user registration functionality all right okay great so here is the main method to launch the application so this is the entry point of our Java program and here we are creating object of user in your class and here it will call the constructor and this logic will be exhibited all right so let's go take let's run this in java application or a java program so right click run as java application so we get here this is the screen now notice what in let's enter the data into a registration form so let me enter for humans in a mesh and last name means for today and in the necklace eyes let me activate gmail.com and username I say today and password just interface for one two or three and know by the more you can intervene a ten digit number here okay and once you fill up the registration form just hit register button here so just hit the register button here and yeah so here we go user account is successfully created okay let's verify the data inserted in a massive database or not so let me switch to the magic of workbench here so let me just refresh Stockholm table yeah here we go so look at here the user is shredded as successfully stored in accountable so this is how this video we create a swing application with registration form and we use as jalebis epa to connect to the magical database and we we basically used a register form to submit the users user register data all right it's pretty simple job program so we just need to create a class which exchange jframe component and we need to create a text fields and labels and buttons and need to write a JDBC quote postcode there is a data it's pretty simple job application alright so we can we can get the source code up this tutorial on this what I prefer on my website so I'll be writing a link of this tutorial in the description so that we can get you can just go to that this tutorial and you can just copy the source code and you can just put it further steps and you want to know more about this tutorial you can just read this tutorial alright so I hope you found this tutorial useful if you have any issues when implementing this tutorial let me know in the comment section I will try to you know value are my shirts pyrrha creating same tutorial using Java epics in upcoming videos so just taste stay tuned and subscribe to my youtube channel whenever I will publish such videos you will get notified thanks for watching I will see you next video
Info
Channel: Java Guides
Views: 101,582
Rating: undefined out of 5
Keywords: java, swing, javaguides
Id: Gwwfetb5CJs
Channel Id: undefined
Length: 18min 7sec (1087 seconds)
Published: Fri Feb 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.