I have a group of textField and I need to add some more to this group dynamically with user input.

For Example Scenario. I have some stuffs that are sold in a shop and I have textFields for each to show their amounts. I get a new kind of stuff. I need one more textField too to show its amount too.

I though as a solution that I could use a textField array and if I add one more I could add it to the array and show it on program but I am curious that is there any possible solution that I do not need to use one extra array and for example use just component array comes from getComponents() method.

Or any possible solution.

Thanks.

Sounds like you should use a Collection (eg ArrayList) of textfields. OR maybe a HashMap to link the textfields to the corresponding "stuffs". Either way, these classes are more flexible and easier to work with than arrays.