aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Can i add multiple text fields at a time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can i add multiple text fields at a time" Watch "Can i add multiple text fields at a time" New topic
Author

Can i add multiple text fields at a time

Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
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

Joined: May 03, 2008
Posts: 4642
    
    5

Offhand, I'd say an ArrayList of JTextField and GridLayout.


luck, db
There are no new questions, but there may be new answers.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

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?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
yes, i need to add a new panel to the cardlayout
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

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

Joined: Apr 18, 2007
Posts: 60
yes, i need to add a new panel to the cardlayout
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can i add multiple text fields at a time