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

I am not aware of the correct term used for the following procedure in
I hope no-one has asked this before (I couldn't find anything, but that may
I hope everyone's doin good. I am facing an issue regarding the images, i
hope it's allowed to crosspost between stackexchange site... Does anyone know how to solve
hope not to be .. boring. In my video game development (2d, in Sdl.NET),
I hope it's stupid, but my head is today right overloaded:) I have this
does anyone here knows the correct way of associating a single entity(a pojo class)
I'm running into an issue with Uploadify and I hope someone can help. I
This question relates to this SO question and answer (rails-3-ssl-deprecation ) where its suggested
What does really POCO mean, in respect to dependencies ? With NHibernate; child collections

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.