about form

Ads

 
 
 

Share on Google+Share on Google+

sujithkumar
about form
1 Answer(s)      5 years and 4 months ago
Posted in : Java Beginners

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.

Ads
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
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
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
Form Tag library configuration
In this section, you will learn about Spring form tag library and its configuration
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
form validation
form validation  how the form validation is done in jsf form using javaScript
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
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
submit a form
submit a form  How can we submit a form without a submit button
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
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
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
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
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
Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads