about form

about form

how to dynamically increase the textbox in the 2nd form when i gave any value in textbox of form1 .

if i gave 5 in the textbox of form1 , totally 5textbox have to be created in form2.

View Answers

January 9, 2012 at 2:54 PM

import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;

class DynamicTextbox extends JFrame{

 JLabel label;
 JTextField  text;
 DynamicTextbox(){
    label = new JLabel("Enter Text");
    text = new JTextField(20);
    JButton b=new JButton("Create");
    JPanel p1=new JPanel(new GridLayout(2,2));
    p1.add(label);
    p1.add(text);
    p1.add(b);
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            int value=Integer.parseInt(text.getText());
            JFrame f=new JFrame();
           JPanel p2=new JPanel(new GridLayout(value,1));
           JTextField text[]=new JTextField[value];
            for(int i=0;i<value;i++){
                text[i]=new JTextField(20);
                p2.add(text[i]);
            }
            f.add(p2);
            f.setVisible(true);
            f.pack();

        }
    });
    add(p1);
    setVisible(true);
    pack();
 }
 public static void main(String args[]){
     new DynamicTextbox();
 }
}









Related Tutorials/Questions & Answers:
about form
about form  how to dynamically increase the textbox in the 2nd form when i gave any value in textbox of form1 . if i gave 5 in the textbox of form1 , totally 5textbox have to be created in form2.   import javax.swing.
The form tag
In this tutorial, you will learn about Spring form tag
Advertisements
form
form   Can I prevent a form from being submitted again
J2ME Form Class
J2ME Form Class       In this J2ME Extends Form example, we are going to discuss about form... discuss about form. In general, a form is a screen and this screen can contain any
Form for Update Customization.
Form for Update Customization In this example, you will learn to make a update customization form in PHP. The code for customization update will be called on HTML form.  In the following program, we have made a program for updating
Appending string in J2ME Form
Appending string in J2ME Form       In the previous example, you learned about how to add items in to the form. In this example we are going to add string into the form. Both
jQuery 'submit' form event
jQuery 'submit' form event In this tutorial, we will discuss about the  'submit' form event of jQuery. In this example... when "submit" event return 'true' to 'form'
Javascript Form validation Example
Javascript Form validation Example In this section we will discuss about how to validate your application form in javascript. In many applications data is accepted through the application form. To specify that the data which has been
Spring Form Tags Tutorial
Spring Form Tags Tutorial Spring framework provides the form specific tags for designing a form. You can also use the simple html form tag also for designing the form. To use the form tag in your JSP page you need to import the Tag
Form Tag library configuration
In this section, you will learn about Spring form tag library and its configuration
Java Servlet : Reading Form Data Example
Java Servlet : Reading Form Data Example In this tutorial, we are discussing about reading form data of a servlet. Reading Form Data : There are three methods of servlet to handle the form data. These are listed below -ADS
How to handle a form in JSP
How to handle a form in JSP       This section teaches you about the creating a from and the procedure of handling the form through the JSP code. This section provides
How to create a form in JSP
How to create a form in JSP       This section illustrates you about the procedure of the creation of a form through the HTML code in the JSP page. You can simply use
jQuery 'select' form event
jQuery 'select' form event In this tutorial, we will discuss about 'select ' form event to display message when we select something inside input box. In this Example, two input text box are given , when we select
User Registration Form Using JSP(JspBeans)
User Registration Form Using JSP(JspBeans)       In this section you will learn about the handling of user registration form using jsp. One of the basic programming tactics
form validation
form validation  how the form validation is done in jsf form using javaScript
Tracking User's Session using Hidden Form Fields
Tracking User's Session using Hidden Form Fields In this Section, We will discuss about tracking user's session using Hidden form field. Hidden Form Field is used to maintain the session. It is one of the method to handle
About struts
About struts  How will we configure the struts
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
Multipage form
Multipage form  I have a multipage form in php with 2 pages wnhen i submit the form data from both the pages should go in database how should i pass teh data from 1st page to 2nd page and then put the entire form data in mysql
jsp form
jsp form  hi sir, one got one got in jsp form after entering the data into the form the data is not saving in the database i will send you code of two forms if dnt understand my problem
Form validation using jQuery plug in & JSP
Form validation using jQuery plug in & JSP In this tutorial, we will discuss about form validation using jQuery plug in & display of submit content using JSP. In the given below example a form is given ,whose fields  like
database spring registration form
database spring registration form We are going to discuss about  database spring registration form. We have created simple spring registration form... registration form. We have used controller and we are using database
submit a form
submit a form  How can we submit a form without a submit button
About MYSQL
About MYSQL  is it possible to upload the video on mysql database...;HEAD><TITLE>Display file upload form to the user</TITLE></HEAD> <BODY> <FORM ENCTYPE="multipart/form-data" ACTION="upload.jsp" METHOD
Play framework dynamic form generation
Play framework dynamic form generation  I want to generate dynamic forms using play framework can any one give me some idea about dynamic form generation using play framework
About Java
About Java  Hi, Can anyone tell me the About Java programming language? How a c programmer can learn Java development techniques? Thanks   Hi, Read about java at http://www.roseindia.net/java. Thanks
Form handling
Form handling  I created a spring project. I created a jsp...;form:form name="loginForm" modelAttribute="loginForm" method="get"> <...;/td> <td> <form:input path="username"/>
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
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
About jsp
About jsp  Read Excel data using JSP and update MySQL databse
about java
about java  how to get the value from the user like c, c++ program pls explain with example for me
about jquery
about jquery  i want to put already made dropdown menu code which is in internet into my website.but how to put
Form validation
Form validation  Hi Everyone Can someone assist me with a complete code to validate a form. e.g where the user must insert an ID number it should check if the user entered the correct data and within a valid range. This must
PHP form
PHP form  Hi Sir/Madam, I am developing an attendance form using php, which displays the name and ID of a Employees which are fetched from Db and I... form and update them to respective coloumn... Please any one help mo out please
other form
other form  Can I write this code in other form: if (quantity>=5) { System.out.println("Congrats!! You get a discount of 5%."); } else { System.out.println("you can avail a discount of 5% when you make a purchase of 5 items
Employee form
Employee form  In employee form emp Id id after any data iserted is incremented for oher data insertion. insert, delete, update buttons when we cleak the select buttoun then the created table data iserted automaticaly
about java1
about java1  Sir, i want to know how we develop 3d button ,lable,textfield etc. in java . sir plz give one program as well Thank you
ABOUT Jtable
ABOUT Jtable  My Project is Exsice Management in java swing Desktop Application. I M Use Netbeans & Mysql . How can retrive Data in Jtable from Mysql Database in Net Beans
About Main
About Main  can u create the object of one interface ? But i can able to create the abstract class through anonimous inner class.similarly can i
About Main
About Main  can u create the object of one interface ? But i can able to create the abstract class through anonimous inner class.similarly can i
about connectivity
about connectivity  hello i am basavaraj,will any one tell me how to use hibernate in struts.   Please visit the following link: Struts Hibernate Integration
About Java2
About Java2  sir i want to a develop one text editor but the problem is that i m not able to save our file as text formet or any formet Sir plz guide me
struts form
struts form  Hi, This is Rajesh.I'm creating struts form in jsp.i have two textboxes in my jsp.During Jsp page loading focus will automatically should come to second textbox(That means during page loading cursor automatically
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
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
About Database
About Database  in my database i enter the date of birth as Birth_Date date but i dont know in which format we can mention the date of birth   In MySQL database, date should be entered in the following format: yyyy-mm
About Jsp
About Jsp  Hello sir, I am developing online Quiz project in jsp using MySql Database. I want to know that How I will show Questions from database One by One on Same page and also want to calculate Result for the User
About Constructor
About Constructor  How many objects are create when this code will execute... String string = new String("Java is best Lang."); tell me the number of object of string which will create . All are those are eligible for garbage

Ads