Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 101859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:51:08+00:00 2026-05-11T00:51:08+00:00

I hope it is correct term-wise to say that components in a GUI is

  • 0

I hope it is correct term-wise to say that components in a GUI is like JButton, JPanel, JTextField, all that good stuff.

I want to create a text field that takes in an integer. Then a submit button can be pressed and based on the integer that was inputted, create that many textfields in a popup window or whatever.

I have no clue, could someone get me started in the right direction?

The trouble I’m having is that I have no clue how to create a for loop to create the GUI components. I mean if I have a for loop and do something like:

print('JTextField num1 = new JTextField()'); 

then in a for loop it will only create 1 text field when I want many. How do I generically create variables of JTextFields?

Thanks for your help…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:51:09+00:00Added an answer on May 11, 2026 at 12:51 am

    Use an appropriate LayoutManager (e.g. GridLayout) to create and add your textfields.

    for (i = 0; i < numberOfTextFields; i++) {     JTextField textField = new JTextField();     container.add(textField);     /* also store textField somewhere else. */ } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hope you're having a good Friday and stuff... okay, so here's my question: All
Good afternoon everybody, first of all I hope this is the correct place to
I hope to access all gui components on a window using tag. But I
(I hope 'bootstrap' is the correct term...) I have a Symfony 1.4 project in
I hope that you can correct me if my syntax is wrong. I could
Hope that someone can share their experience with some of the latest emerging backbone.js
Hope you all are fine and rocking your code editors. My question is how
hope all is swell! I was hoping I had cracked this problem but it
Hope someone could help me with this: I would like to have a column
fact : servlet container creates one instance per servlet(hope i am correct on this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.