I have to create, from a click of a button, a JLabel
dynamically. So that these labels are arranged in an order, giving a name for this JLabel
.
The user can create as many labels as he wants ...
How do I do this?
In my action , I have this:
String name = "cor";
int x = 0;
int y = 0;
JLabel label = new JLabel();
label.setName(name);
label.setBounds(x, y, 150, 150);
However, it does not add. Where am I going wrong?