Changing variable name with java.lang.reflect.Field help needed

In my program, I want have Java create multiple distinct buttons that i can individually reference to. A tedious way for the same effect would be:

JButton button = new JButton(words);

JButton button1 = new JButton(words);

JButton button2 = new JButton(words);

//sets different sizes for different buttons

button1.setSize(56,654);

button2.setSize(45,23);

But i have 100 buttons, theres no way i can use the above step.

I have:

while(numButton<100){

JButton button = new JButton(words);

...

jpanel.add(button);

numButton++;

}

As you see there is no way for me to individually call on one of the buttons, I already have code that auto generates the appropriate variable name for each button, but I do not know how i can change button for something else. Then i heard of java.lang.reflect.Field, but I'm not too sure(even after looking it up), on how it works, and whether or not if it can solve my problem. Can someone show me the way?

If that wont help me is there another way?

heres another one of my illustrations to get my meaning clear:

while(numButton<100){

JButton bu_array[num] = new JButton(words);

num++;

...

the above code doesn't work of course, but it illustrates the idea that i want a different variable name assigned to the button on every loop.

thanks!

[1424 byte] By [Zhanglea] at [2007-11-26 17:13:53]
# 1
Forget about the variable names, they don't mean anything. Why not follow up your idea of using an array of buttons?
DrClapa at 2007-7-8 23:41:51 > top of Java-index,Java Essentials,Java Programming...
# 2
Also, chances are excellent that unless you're writing Minesweeper you have a UI design issue. Not many reasonableUIs truly call for that many buttons in one class.
es5f2000a at 2007-7-8 23:41:51 > top of Java-index,Java Essentials,Java Programming...
# 3
Don't really know what you are attempting to do, but my example in this posting shows you you can use multiple buttons without knowing its variable name: http://forum.java.sun.com/thread.jspa?forumID=57&threadID=609795
camickra at 2007-7-8 23:41:51 > top of Java-index,Java Essentials,Java Programming...