This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In my application, a db query is executed, gets the ids from db, & stores it in a list.
Then those many numbers of JLabel and JTextfields is created. Here is what i tried :
The list contains 2 numbers, 1 & 2. So the code creates 2 jlabels 1 & 2 with their respective textfields. So far, its good. But, how will i get their values after SUBMIT (JButton) is pressed? (JTextfields and Jlabels are declared inside the method, of whose code i have posted. )>
If I understood your problem well, you're asking how to access specific component (in this case JTextField) if you added it dynamically to your panel. Am I right?
If that is the case, once you handle the appropriate event (click on a button) you will need to iterate over all components placed inside your container and find the one that matches the name you are looking for. Once you access it, you can get its content with getText()
The quieter you are, the more you are able to hear.