• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i add multiple text fields at a time

 
Srinivasa Maddi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using CardLayout in my swing app and here in one of the panel i have to provide the users with a facility, which should allow them to add as many members as they want to a 'batchId'('batchId' is already in place). I have created a simple JPanel that displays only 10 textfields(hardcoded). This will restrict my user to go beyond 10 members. I want something like the number of textfields on the panel should be increased dynamically on the users wish. What is best action that i can take on now?
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Offhand, I'd say an ArrayList of JTextField and GridLayout.
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you can call panel.add(new JTextField()) and call a revalidate and repaint on the panel.
Or did you mean add a new panel to the card layout?
 
Srinivasa Maddi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i need to add a new panel to the cardlayout
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srinivasa Maddi:
yes, i need to add a new panel to the cardlayout


Add the new panel to the panel having the card layout and referesh the UI.
 
Srinivasa Maddi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i need to add a new panel to the cardlayout
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srinivasa Maddi:
yes, i need to add a new panel to the cardlayout


I think that now this has been clearly stated. Good luck with this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic