This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You can add and remove Components from other GUI components at any time with the add and remove methods. Just be careful about Layouts, because the whole thing may change shape when you do so. You can also keep Frames or Dialogs which become visible(true) or visible(false) as required.
Does that help you? [ July 10, 2008: Message edited by: Campbell Ritchie ]
Joined: Jul 09, 2008
Hi Campbell Ritchie,
Thanks for your reply and suggestion. Your answer however doesn't totally satisfy the requirement I am looking for.
What I am trying to do in the project is:
The user has to enter the "Number of variables" in a text box. If the user enters "4" in the text box, then 4 text boxes have to be added below the above text box during runtime on the same page. If the user types 2 in the "Number of variables" text box then only two text boxes have to be added on the same page.
This is equivalent to adding "Components" to a page dynamically. How will I be able to do it at runtime?
Joined: Oct 13, 2005
There are probably hundreds of possible solutions, but how about this:-
Parse the text to work out how many JTextFields you require.