April 6, 2011 at 10:59 AM
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
class CreateAccount extends JFrame {
JTextField text1, text2, text3, text4, text5;
JPasswordField pass1;
JLabel label1, label2, label3, label4, label5, label6;
JButton button, button1;
CreateAccount() {
setLayout(null);
text1 = new JTextField(15);
text2 = new JTextField(15);
text3 = new JTextField(15);
pass1 = new JPasswordField(15);
text4 = new JTextField(15);
text5 = new JTextField(15);
label1 = new JLabel("First Name");
label2 = new JLabel("Last Name");
label3 = new JLabel("User Name");
label4 = new JLabel("Password");
label5 = new JLabel("Address");
label6 = new JLabel("Phone No");
button = new JButton("Save");
button1 = new JButton("Exit");
label1.setBounds(350, 100, 100, 20);
text1.setBounds(450, 100, 200, 20);
label2.setBounds(350, 130, 100, 20);
text2.setBounds(450, 130, 200, 20);
label3.setBounds(350, 160, 100, 20);
text3.setBounds(450, 160, 200, 20);
label4.setBounds(350, 190, 100, 20);
pass1.setBounds(450, 190, 200, 20);
label5.setBounds(350, 220, 100, 20);
text4.setBounds(450, 220, 200, 20);
label6.setBounds(350, 250, 100, 20);
text5.setBounds(450, 250, 200, 20);
button.setBounds(350, 280, 100, 20);
button1.setBounds(450, 280, 100, 20);
add(label1);
add(text1);
add(label2);
add(text2);
add(label3);
add(text3);
add(label4);
add(pass1);
add(label5);
add(text4);
add(label6);
add(text5);
add(button);
add(button1);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String value1 = text1.getText();
String value2 = text2.getText();
String value3 = text3.getText();
String value4 = pass1.getText();
String value5 = text4.getText();
String value6 = text5.getText();
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
;
String db = "test";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass = "root";
String user1 = "";
String pass1 = "";
try {
Class.forName(driver);
con = DriverManager.getConnection(url + db, user, pass);
Statement st = con.createStatement();
int i = st
.executeUpdate("insert into login(firstname,lastname,username,password,address,contactno) values('"
+ value1
+ "','"
+ value2
+ "','"
+ value3
+ "','"
+ value4
+ "','"
+ value5
+ "','"
+ value6 + "')");
JOptionPane.showMessageDialog(null,
"Data is successfully saved.");
} catch (Exception e) {
}
}
});
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
setVisible(false);
}
});
setSize(1024, 768);
setVisible(true);
}
public static void main(String args[]) {
new CreateAccount();
}
}
Related Tutorials/Questions & Answers:
WindowWindow how to create an
window of a person like regestration form
window in centerwindow in center if i run the programme thw
window is in lie in top left corner i want a
window open in center
Advertisements
Window BlindWindow Blind Custom built . Over 30 years of shutter experience. Free in-home consultations
Chat window the chat
window pops up.. It is a div in the chat homepage.. There are few other... in the same application.
I want to know how to retain the chat
window (along..., the chat
window should be constant across all pages in the application for current
Multi window contains all the details.
when i submit this page, a new
window opens and asks to enter password.
if password entered is correct, the flow goes to previous
window window closingwindow closing hello,
In my project i have login,logout and some jsp pages are there and each jsp page is using javascript and onunload script.
and i need one solution that,when ever user trying to close browser
window Window ScriptWindow Script i want to write windows script can you help me in writing those
i want to write script so that it follows below steps
Step
1) downloading file from FTP
2) Unzip it
3) Edit it
4) zip it
5) upload again to FTP
active window meansactive
window means active
window means what?
The active
window is the term used to describe the
window that is currently being used
Passing values from child window to parent window.Passing values from child
window to parent
window. Hai,
I'm having a requirement ,in that when i open a (pop-up)child
window from a parent
window,the child
window will contain multiple checkboxes and when i select multiple
ModuleNotFoundError: No module named 'window'ModuleNotFoundError: No module named '
window' Hi,
My Python... '
window'
How to remove the ModuleNotFoundError: No module named '
window'... to install padas library.
You can install
window python with following command
Passing values from child window to parent window.Passing values from child
window to parent
window. http://www.roseindia.net/java/pass-value-example/pass-value-child-to-parent.shtml
I have gone thru the link but my requirement is checkboxes.can u please explain
Java window state eventJava
window state event Two java windows, one on top of another...
Window at the back is deactivated when the other is on the top. Can iconify when there is only one
window using win+d key.
In windows, press win+d,
window Prototype Window ClassPrototype
Window Class
This javascript class allows you to add
window in a HTML page...
if you include effects.js file , but it's not mandatory.
Prototype
Window Pop Up window - WebSevicesPop Up window How refresh pop up
window,Tell me correct code for this problem. Hi friend,
I am sending a link. This link will help you.
Visit for more information.
http://www.roseindia.net/jsp/popup-
window Window State - Swing AWTWindow State Thanks for you reply.
I have already tried the setSize() method of AWT
Window and also with JFrame. But I want to Maximize the
Window when it is opened by the user and instead of the Maximize
child window - Development processchild window I want to create new small
window on my website using java script. But i couldn't hide the status bar in small
window. How to do this one ?
Kindly help me. Hi Friend,
Please visit the following
window addsubview remove in iPhonewindow addsubview remove in iPhone Hi,
How to add a splash screen or some other view and then remove it and add new view.
I want program... can use following code:ADS_TO_REPLACE_2
[
window addSubview:tabBarController.view
Closing the browser windowClosing the browser window <BODY>
<form>
<input type=button value="Close
Window" onClick="javascript:window.close();">
<...;
thought that this will close the
window of the browser but not working
swings window headerswings
window header i have a string1 it contains 3 parts,for example "123456 service hello"
and string2 contains "change request " like... for this program .
i want to apply this to
window header part.
Thanks
Sliding window protocolSliding
window protocol Hello Everyone.
Will anybody send me the code to make sliding
window protocol animation using java swings.
I have to do project with all types sliding protocols such as selectiverepeat,gobackN..etc.
I
JSP Window. Open
JSP
Window. Open
JSP
Window. Open is used to open a new
window in JSP. The JavaScript
function window.open( ) open a new browser
reload parent window - WebSevicesreload parent window Hi,
Here I have a code for close child
window and reload parent
window.
window.opener.location.href="http://www.mysite.net/example.php";
self.close();
Its working properly when User enters
How to Make iPhone Window ApplicationHow to Make iPhone
Window Application Hi,
For Making iphone
window application, what parameters i have to follow or provide example related to iphone
window application.
Thanks
The Window Event - Swing AWTThe
Window Event hey plz i need help here...
plz modify..., 700);
setTitle("The
Window Button");
setVisible(true...;
}
}
});
add(exit_button);
setVisible(true);
setSize(100, 50);
setTitle("
Window JavaScript Open Modal Window
JavaScript Open Modal
Window...;
In this section, you will learn how to open Modal
window in JavaScript.
As we have already discussed about the window.open() method of
Window
object which
POP UP WINDOWPOP UP WINDOW Dear Sir,
Can you please help in providing the methos for opening up a pop up
window just after selecting an option from a drop...',then a pop up
window should open with name,designation and roll number.Please help me
Pop-up WindowPop-up Window Hi.........
please tell me
How do I pass parameters to a pop-up
window?
Thanks For example:
code for pop-up
window:
<?xml version="1.0"?>
<s:TitleWindow xmlns:fx="http
Window Container in Flex4Window Container in Flex4 :
This container are use
window applications in flex 4. Spark
Window container is provide a way if user want to create own
window.
The
Window container are provide layout and content of operating system
window Popup Window Example in JavaScript
Popup
Window Example in JavaScript
In this article you learn popup
Window in java script.
Three kinds of popup windows are available in java script
opening new window - Java Beginners window.i.e.,
I want to know, how a new
window(B) can be opened by clicking a button on the first(parent)window.The show() method does open a new
window but the parent
window is not disabled when the child(new)
window is showing.The show() method
Pass value from child to parent window
Pass value from child to parent
window
Java example program to pass value from child
window
to parent
window
We can pass values from a child
window in Html to the
parent
popup window checkbox and sbumit buttonpopup
window checkbox and sbumit button Hi,
Requirement: popup
window having multiple checkboxes, I have to select couple of checkboxes and click the submit button.
I am unable to get the check box values... need help
Creating Modal Window in Flex
Creating Modal
Window in Flex
In the Adobe flex application you can also create the Modal
Window
with the help of the container Title
Window and mx.component.PopUpManager
class
JavaScript Open link in new window
JavaScript Open link in new
window...;
In this section, you will learn how to open a new
window on clicking the link
using JavaScript.
To open a new
window with a link within the web