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

Ads









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
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
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
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
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
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
About struts
About struts  How will we configure the struts
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
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
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
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
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
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
about jquery
about jquery  i want to put already made dropdown menu code which is in internet into my website.but how to put
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
submit a form
submit a form  How can we submit a form without a submit button
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 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 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
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
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

Ads