JLabel jLabel2 = new JLabel(image);
addComponent(cp, jLabel2,373+x,47+x,70+x,18+x);
its always jLabel2 now i was wondering is there a way to change the instance name to be something different everytime the button is pressed
Originally posted by Layne Lund:
But in this case do you REALLY need to store all those JLabel references? Labels are not typically interactive and so there usually is not a reason to store their references. This might be different if you had multiple JTextFields or some other interactive control that you might want to manipulate.
Originally posted by Ronan Cantona:
I have a form created where i click on a button and new labels are added to it. The only thing is i only can get it adding the labels under the same instance name. e.g
JLabel jLabel2 = new JLabel(image);
addComponent(cp, jLabel2,373+x,47+x,70+x,18+x);
its always jLabel2 now i was wondering is there a way to change the instance name to be something different everytime the button is pressed