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

View Answers

August 8, 2012 at 5:30 PM

If you want to design form in java swing then here is a code:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
class Form extends JFrame
JButton ADD;
JPanel panel;
JLabel label1,label2,label3,label4,label5;
final JTextField text1,text2,text3,text4,text5;
label1 = new JLabel();
text1 = new JTextField(20);

label2 = new JLabel();
label2.setText("First Name:");
text2 = new JTextField(20);

label3 = new JLabel();
label3.setText("Last Name:");
text3 = new JTextField(20);

label4 = new JLabel();
text4 = new JTextField(20);

label5 = new JLabel();
text5 = new JTextField(20);

ADD=new JButton("submit");

panel=new JPanel(new GridLayout(6,2));
ADD.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value1=text1.getText();
String value2=text2.getText();
String value3=text3.getText();
String value4=text4.getText();
String value5=text5.getText();
JOptionPane.showMessageDialog(null,"Hello "+value2);

class FormDemo
public static void main(String arg[])
Form frame=new Form();
catch(Exception e){

And if you want to design a form in jsp then use html tags.

<form name="userform" method="post" >
<tr><td>User Name</td><td><input type="text" name="user"></td></tr>
<tr><td>Password</td><td><input type="password" name="pass"></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="cpass"></td></tr>
<tr><td>Name</td><td><input type="text" name="name"></td></tr>
<tr><td>Phone</td><td><input type="text" name="phone"></td></tr>
<tr><td>Contact</td><td><input type="text" name="contact"></td></tr>
<tr><td><input type="submit" value="Search"></td></tr>

Related Tutorials/Questions & Answers:
How to design a form using java?
difference between java5 and java6 - Java Beginners
about java1
How to design https connection page using JSP
How to validate form using Spring MVC?
how to write a jsp form using html
javaa swings - IDE Questions
Design of java form
How to implement Captcha in PHP Form using GD Library
how to update values of a html form into an excel table using java servlets?
how to load values of html form into an excel table using java servlet?
How to display data in form using aryylist in struts - Java Beginners
How to Create Login/ Registration Form using PHP and MYSQL
how to prepare railway reservation form using core java concepts
How to put the logo in login form using swings/awt?
create a form using struts
How to get xml file form http port using web service
How to save form data to a csv file using jquery or ajax
About Java2
how to save html form data into .csv file using only jsp.
How do i validate form using javascript and send data to database?
How to create runtime drag and drop form builder using mvc and jquery
how to connect the database using hibernet through servlet/jsp through form
how to design a parser - Design concepts & design patterns
How to design Form Layout in Flex Using Container
Without Using Form in Java Script
java login form using netbeans
Javap Tool application
how to generate a bar chart on a JSP PAGE using the arraylist object passed form the servlet.(using jfreechart)
User Registration Form Using JSP(JspBeans) after that how i can insert in database
Html form validation using jquery
Maven dependency for com.gooddata - gooddata-http-client version 1.0.0+java7 is released. Learn to use gooddata-http-client version 1.0.0+java7 in Maven based Java projects
How to design a flower, design a flower
javas - JSP-Servlet
Javah -  Header File Generator
How to design a turn corner of the paper
Hiding form values using ajax
ModuleNotFoundError: No module named 'javax'
ModuleNotFoundError: No module named 'javax'
How to reset a form in jQuery?
user Registration form using bean
HTML form validation using jquery
Form validation Using Jquery Plugin
registration form using oop concept
struts2 how can we add an radio button to form using a class(doa)
struts2 how can we add an radio button to form using a class(doa)
How to design a glass
How to create form in Swings