Dear All,
I am new in Java programming now i want to create registration form connect to mysql database for store information of register people in mysql database.
I really appreciate if anyone can help me about coding and design form in swing GUI.
Thanks!
Register Form with Swing GUI inJavaRegister Form with Swing GUI inJava
Page 1 of 1
4 Replies - 16025 Views - Last Post: 26 May 2010 - 06:29 PM
Replies To: Register Form with Swing GUI inJava
#2
Re: Register Form with Swing GUI inJava
Posted 26 May 2010 - 03:24 AM
You could check out the java tutorials here on the forum. Look for swing tutorials and jdbc tutorials for connecting to mysql.
#3
Re: Register Form with Swing GUI inJava
Posted 26 May 2010 - 04:25 AM
Well, your gonna want to use JTextFields within your program, get the text of them and store them in variables.
For things such as Date, i would have a JComboBox having the dates on there.
Heres a useful url to get you started with the JDBC (MySQL). Using JDBC with MySQL Getting Started.
So lets say you get the name of the JTextField, you assign the value to a String called name.
From there you will have a connection, something looking similar to this below, check out what parameters you will need.
Make sure that you have this as within your class.
You will then invoke a createStatement() method on the con (Connection) object which will create a statement.
You will then invoke the executeUpdate() method on the Statement object having the query as String as the method takes a single String as its parameters.
Something like this..
Obviously, you are going to insert more data, this is just a simple example
For things such as Date, i would have a JComboBox having the dates on there.
Heres a useful url to get you started with the JDBC (MySQL). Using JDBC with MySQL Getting Started.
So lets say you get the name of the JTextField, you assign the value to a String called name.
From there you will have a connection, something looking similar to this below, check out what parameters you will need.
Connection con = DriverManager.getConnection("jdbc:mysql:///test",
"root", "secret");
Make sure that you have this as within your class.
Statement stmt;
You will then invoke a createStatement() method on the con (Connection) object which will create a statement.
stmt = con.createStatement();
You will then invoke the executeUpdate() method on the Statement object having the query as String as the method takes a single String as its parameters.
Something like this..
stmt.executeUpdate(
"INSERT into Register values ('"+name+"'");
Obviously, you are going to insert more data, this is just a simple example
This post has been edited by m-e-g-a-z: 26 May 2010 - 04:29 AM
#4
Re: Register Form with Swing GUI inJava
Posted 26 May 2010 - 06:22 PM
Thank you for your kindly reply!!!
#5
Re: Register Form with Swing GUI inJava
Posted 26 May 2010 - 06:29 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|