Scenario :
public class frame1 extends javax.swing.JFrame {
public void processName(){
String n1 = "txtName";
JOptionPane.showMessageDialog(null,"**here i want to show the value from the JTextField using String Variable n1 ,just like we do txtName.getText()**");
}
private javax.swing.JTextField txtName;
}
I know the Question above is weird but the situation which i am in, I must find some other way. please let me know if there's any solution. Thanks.
NOTE : I pasted only the relevant code above. Please assume that I call processName() function on a Button click event.
EDIT : The Exact Problem is : I have a list of JTextFields that have exactly same name as Database fields. Now I want to populate those JTextFields with data from the database using a while loop. And they are many. So I don't want to change the JTextfield names or Database field names.