I have the following code and I know there must be a way to simplify it, I just don't know enough about Java to know how. Is there any way that you could create an array of buttons? That way I could just use a for loop to set their values, position, and create them. Thanks in advance!
Button buttons is another way. You'll find this technique neat when you are just creating a GUI with no real workings. But once you need all those buttons to actually do something, the technique won't really work anymore. Well, unless all the buttons do the same thing.
posted 11 years ago
If all the buttons are in an array you can use a for loop in the actionPerformed method as well.
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad: