posted 20 years ago
The name of each widget (e.g. a JLabel) is set by the compiler and I can't see how you can change that during runtime. However, I can see a couple of avenues to label your widgets if there are a lot of them.
Firstly, you could do an array of widgets, and equate the int element to a name. Then write a method to search the name strings for the array numbers.
Secondly, without using an array, you could set up a map of key/value pairs with the key being the name and the value being the widget. Then write a method to return the widget on imputting a name.
The nice thing about Standards is that there are so many to choose from!