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




Have Programming Question? Ask it here!
 
 
 


sujithkumar
about form
1 Answer(s)      2 years and 3 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
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
form validation
form validation  how the form validation is done in jsf form using javaScript
Form Tag library configuration
In this section, you will learn about Spring form tag library and its configuration
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
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
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
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
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
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
Login Form
of +,on clicking which a login form appears. Only the middle column is different
Login Form
of +,on clicking which a login form appears. Only the middle column is different
jsp form
jsp form  hai... GoodEvening I have one doubt on jsp.please wil u clarify it. how to move one jsp form to another jsp form with out using forward...)form1.jsp: <html> <form method="post" action="form2.jsp"> <table>
form submission
form submission  I have two pairs of textboxes...( so in total 4...("Enter text4 value!"); return false; } return true; } </script> <form name="form" method="post" onsubmit="return validate();"> <input type="text
form validation
form validation  <form name="form" method="post" action="process.php" onsubmit="return validate(); "> <table align="center" border="1px" bgcolor="orange" > <tr><td>username:</td><
dynamic form
dynamic form  I need to make a dynamic form using php, for example, i... button wich once clicked we have a new list created on the same form. Thank you...); } } </script> <form method="post" action="" name="form1"> <
Dynamic form
Dynamic form  I need to make a dynamic form using jsp for example, i will need a list of items which when we select one option another list... clicked we have a new list created on the same form. Thanks for your help  
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
jsp form
jsp form  hi i have one excuted jsp form.and in that the data should be dispaly on another jsp form.please help me thanks in advance   Hi Friend, Try this: 1)form1.jsp: <html> <form method="post" action
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
registration form
="center" border=0&gt; &lt;form name="f1" action="CreateUser
About struts
About struts  How will we configure the struts
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
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
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
JavaScript Form Validation
JavaScript Form Validation  JavaScript Form Validation
about jquery
about jquery  i want to put already made dropdown menu code which is in internet into my website.but how to put
Advertisements
 

 

 

DMCA.com