I need to perform actions on hundreds of buttons. I'm looking for a way to use a loop for the jButton index, instead of writing hundreds of lines of code just to change the color of multiple buttons. I want something like this:
for(int i = 1; i < 100; i++){
jButton("i").setForeground(Color.red)
}
So for example for n=18, the command executed is:
jButton18.setForeground(Color.red)...
Which obviously does not work, but there has to be a simpler way than to write a line for each button!