Home Answers Viewqa Java-Beginners Design of java form

 
 


santosh satnami
Design of java form
1 Answer(s)      2 years and 6 months ago
Posted in : Java Beginners

sir can u plz help me i want to design a interactive java form mins some thing diffrent in form is it possible in java if yes then help me

thank u

View Answers

December 22, 2010 at 5:30 PM


Hi Friend,

Yes, you can using java swing.

Try this:

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();
}

}

Thanks









Related Pages:
Design of java form
Design of java form  sir can u plz help me i want to design a interactive java form mins some thing diffrent in form is it possible in java if yes then help me thank u   Hi Friend, Yes, you can using java swing
How to design a form using java?
How to design a form using java?  Please help in designing of form using java for my project
html form - Java Beginners
html form  Hi, I wnt to design a form with more than one action in submit button.thanks. regards, sakthi  Hi friend, You specify your main requirement of form with more then one action. Thanks
registration form
registration form  Hii.. I have to design one registration page in java that looks like REGISTER USERNAME (here i have to check whether... to design captcha) submit (while clicking on submit button i have to send
java design
java design  What is design by contract
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert... another.that page should b smthng like this: <%@ page language="java" import...;Configuring Page</title> </head> <body> <form action
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert... another.that page should b smthng like this: <%@ page language="java" import...;Configuring Page</title> </head> <body> <form action
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert... another.that page should b smthng like this: <%@ page language="java" import...;Configuring Page</title> </head> <body> <form action
DAO DTO design pattern
DAO DTO design pattern  Hi,using dao and dto i want to perform insert... another.that page should b smthng like this: <%@ page language="java" import...;Configuring Page</title> </head> <body> <form action
java - Design concepts & design patterns
java  give the code to design the hotel management software
Java - Design concepts & design patterns
Java  What are design patterens?  Hi friend, Software professionals may be familiar with the term "Design Patterns," but many have... not see the value and benefits design patterns bring to the software development
Java - Design concepts & design patterns
Java  Sir , please let me know the exact usage of DAO design pattern  Hi Friend, Please visit the following link: http://www.roseindia.net/javatutorials/J2EE_singleton_pattern.shtml Thanks
java - Design concepts & design patterns
java  Q What is the disadvantage of Singleton design pattern?  Hi Friend, 1)It allows only one instance of the class. 2)If the Singleton has synchronized blocks in it, it might slow the system down as the threads
java - Design concepts & design patterns
java  design a vehicle class hierarchy in java.write a test program to demonstrate polymorphism.  Hi Friend, Try the following code: class Vehicle { void test(){} } class Bus extends Vehicle{ void test
java - Design concepts & design patterns
java  what is singleton design pattern?Give implementation of singleton design pattern? what is factory design pattern?and give its implementation.   Hi friend, class Singleton{ public static void main
java - Design concepts & design patterns
java  design a java interface for ADT stack.develop two differant classes that implement this interface,one using array and the other using using linked list.provide necessary exception handling in both the implementations. 
java - Design concepts & design patterns
java  1.write a multi-threaded java program to print all numbers below 100,000 that are both prime and fibonacci number(some examples are 2,3,5,13,etc).design a thread that generates prime numbers below 100,000 and writes them
how to design a parser - Design concepts & design patterns
how to design a parser  sorry i am not sure in which category i have to put my question actually i have to design a LR (0) parser for a given grammar in java i am confused how to implement this i know how the parser
java - Design concepts & design patterns
java  Q.No-1. Design a menu-driven interactive programme to find out capital cities of all the states of India using switch statement. Q.No-2. Write a programme to perform binary operations on integer argument. The arguments
java - Design concepts & design patterns
java  design classes for currency,rupee,and doller.write a program that randomly generates rupee and doller objects and write them into a file using object serialization.write another program to read that file,convert to rupee
java - Design concepts & design patterns
java   1.Develop multi-threaded echo server and a corresponding GUI client in java
java - Design concepts & design patterns
java  what is code for create 100 stringbuffers?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/string-examples/creation-of-stringBuffer.shtml Hope that it will be helpful for you
web design
web design   Hii.. I have to design one registration page in java... (here i have to design captcha) submit (while clicking on submit... design that. Please help me asap Thanks a lot
java - Design concepts & design patterns
=28457 In java, we just declare Object references. Though you use the phrase
Design, develop and test JSPs
Design, develop and test JSPs Prev Chapter 2. Design, build and test web components Next    Design, develop and test JSPs Creating
Design - Java Beginners
Design  What is Software Design & development
Design and develop entity EJBs
Design and develop entity EJBs Prev Chapter 1. Design, build and test reusable enterprise components Next    Design and develop entity EJBs
Creational Design Patterns
Creational Design Patterns       Creational design patterns provide the best way in which... instances . Everyone knows the object instance in Java can be created using a new
design patterns - Java Beginners
design patterns  what are the design patterns used in java?  Hi Friend, Please visit the following links: http://www.roseindia.net/designpattern/index.shtml http://www.roseindia.net/javatutorials/J2EE_singleton
Design pattern - Java Beginners
Design pattern  How to make a java program to check the java program is already started if started the execution then dont allow the new program to start
Book Review - Head First Design Patterns
Book Review - Head First Design Patterns Design Patterns are proven solution to the software design problems. Design patterns save a lot of the time in the programming. This article discusses about the book "Head First Design
web design - Design concepts & design patterns
use java script or any other script. like that side click left side image
Mobile Skins Design Services
, JavaScript, JME, JSP.net and Java. We design latest, classic, trendy, beyond...Mobile Skins Design Services Mobile Skins are all electronic devices... provides a different look to same type of mobile phones. The skin design comes
Form Validation
Form Validation  Java script validation for checking special characters and white spaces and give an alert.Please help me urgent Thanks in advance
Object oriented design - Java. - Design concepts & design patterns
Object oriented design - Java.  Hi, Everyone.Pls help me to develope my project of Object oriented design, as I have to submit it on thursday,3rd Dec. 2009.Nowadayz I am suffering from fever and not able to concentrate
Java Model View Controller (MVC) Design Pattern
; margin-left: 400px; } .style4 { margin-left: 160px; } Java MVC ( Model View Controller ) Design Pattern Model View controller is a classical design... logic and view who represents data. MVC design pattern isolates
Java Collections - Design concepts & design patterns
Java Collections  I am designing an application where the program is meant to read from 2 different text files (eg FileA and FileB) containing so... but it takes up to 1 hour to complete the task. PLEASE I need a design concept
Javascript - Design concepts & design patterns
Javascript  please I am trying to write a Javascript that can count the occurences of a words in a string and output the result in a sequential order. I want to have this done in Javascript and not Java. is it possible? Can
jav a - Design concepts & design patterns
jav a  Q.1. Write a program in Java to perform the addition of two complex numbers.   Hi Friend, Try the following code: public class ComplexNumber{ private int a; private int b; public ComplexNumber
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
Java Collections - Design concepts & design patterns
Java Collections  I am designing an application where the program is meant to read from 2 different text files (eg FileA and FileB) containing so... a design concept or pattern that will achieve the task in the fastest time. Thank
Write a program to design a page.use radio button?
Write a program to design a page.use radio button?  i would lik... components to create a form on frame. import java.sql.*; import javax.swing....(); } public SwingFrame(){ JFrame f = new JFrame("Frame in Java Swing
java project - Design concepts & design patterns
java project  Hi, I wish to write a Java application project in school. I wish to humbly request for sample java project source codes to enable me write one. eg Hotel Reservation System, Flight scheduling system, Passenger
Java Script - Design concepts & design patterns
Java Script  how to merge two excel sheet using javascript, kindly give some clue
Design Pattern in flex
Design Pattern in flex  Hi.... I want to know about What design patterns have you used? in Actionscript and java? please give me the name of this design pattern... Thanks   Ans: Singleton design pattern is used
java script books - Design concepts & design patterns
java script books  Hi All, How are u? My Question is related to java script , what is the best book for javaScript (core and the advance feature). and also send me the name of WebSites. thanks and regards
java script code - Design concepts & design patterns
java script code  I want make header like-http://www.sigmainfotech.com.au/ this site but in this site header make in flash, I use java script or any other script. like that side click left side image it expand in header