I've been looking all over the net for a code that is something like this:
JTextField[] jt = new JTextField{jTextField1,jTextField2,..};
I had a copy of this code once and I kept it in a hard disk because I know I might use it in the future, but the disk died!
can anyone help me find this code? It gives me error so please do correct this for me. thanks!
by the way, this is an array for an existing jTextField and it runs inside a button when pressed.
EDIT: since this was flagged as possible duplicate, heres my explanation.
The classic initialization has already been tested and what ive seen yet so far in declaring jTextField array is this:
JTextField[] jt = new jTextField[10];
specifying the value then adding it.
jTextField[n] = new JTextField(jTextField1);
if i use that method, I would have to type it all over again.
jTextField[n] = new JTextField(jTextField2);
jTextField[n] = new JTextField(jTextField3);.. and so on and so forth.
now what I am looking for is what i've said on the sample code. I have used this once but I was clumsy enough not to back it up.