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



Home Answers Viewqa Java-Beginners programing question

Have Programming Question? Ask it here!
 
 
 


jude chingits
programing question
1 Answer(s)      3 years and 9 months ago
Posted in : Java Beginners


how do i use loops(for,while) to add components in java


Advertisement
View Answers

November 15, 2010 at 11:48 AM


Hi Friend,

The below code might help you.

import java.awt.*;
import javax.swing.*;

class TextFieldArray extends JFrame{
 JLabel  l[]=new JLabel [5];
 JTextField  t[]=new JTextField [5];
public TextFieldArray(){
JPanel panel=new JPanel(new GridLayout(5,2));
for(int i=0;i<5;i++){
    int j=i+1;
l[i]=new JLabel("Label"+j);
t[i]=new JTextField(5);
panel.add(l[i]);
panel.add(t[i]);
}
add(panel);
setVisible(true);
pack();
}
public static void main(String[] args){
new TextFieldArray();
}
}

Thanks



Related Tutorials/Questions & Answers:
programing question
programing question  how do i use loops(for,while) to add components in java   Hi Friend, The below code might help you. import java.awt.*; import javax.swing.*; class TextFieldArray extends JFrame{ JLabel l[]=new
Java programing
Java programing   need help wrting this Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter). thanks
Advertisements
socket programing in servlet
socket programing in servlet  give me a example to write socket programing in servlet
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT  I WANT TO KNOW ABOUT THE JAVA SOCKET PROGRAMING FROM BASIC LEVEL AND HOW CAN I WORK ON IT I KNOW THE JAVA PROGRAMING.SO PLEASE HELP ME HOW CAN I DO SOCKET PROGRAMING
question
question  Sir, Please give me a source code for client server socket programing in java
Java programing help
Java programing help  Can you help me create this program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign
javascript programing error - JSP-Servlet
javascript programing error  hi deepak i m using explorer to run javascript program in this there is no option to check error will u plz tell me the way to check error in explorer as we can check with mozila
help with substring in c programing
help with substring in c programing  Hi I could not found programming in C in the "select category" so I am posting my question in java section. Please help with substring function,prompt the user for two strings and display
java programing problem - Java Beginners
java programing problem  Create a class named Movie that can be used with your video rental business. The Movie class should track the Motion picture Association of America rating , ID Number, and movie title with appropriate
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog
Advertisements
 

 

 

DMCA.com