I am stuck at a problem and I have been googling around and read quite few resources and feel direction right now.
HERE is my problem. I am working on an application which will act like CRUD application for a MySQL database with variable tables and structures, I cannot have fixed no. of tables and structures.
I am directionless at creating form for variable table structure. What i want to achieve is when a user selects the table name from combobox relevant no. of fields should be created after retrieving the table structure of that particular table.
Achievement so far: -I have been able fetch structure/schema, data types, data of the table. -Can write queries to create, update, delete the same.
can't succeed in: -I want to create JTextField with unique object names of JTextField relevant to associated column name in the table. -Column names are String type how can I covert them to Object of JTextField.
For example
String f1 = "fieldname_1"; // In reality these string values will be fetched from database resultset containing column names as identifier.
String f2 = "fieldname_2"; // In reality these string values will be fetched from database resultset containing column names as identifier.
JTextField f1 = new JTextField ();
or
String[] f = {"fieldname_1", "fieldname_2"};
JTextField f[0] = new JTextField ();
but it gives error such as f1 is already defined
Note : I want to have input field names to be unique so that i will be easier to access there data after input.
Corrections to the question are welcome, If my approach to handle the problem is wrong give a brief idea/approach to pursue it in right direction.
Regards