Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sujithkumar
about form
1 Answer(s)      2 years and 8 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.


Advertisement
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
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
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
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
 

 

 

DMCA.com