Any way to simplify that? Maby with a loop or something similar?
button1.setVisible(true);
button2.setVisible(true);
button3.setVisible(true);
CodePudding user response:
Never use "numbered variables". Use an array if you have a fixed number of them.
Button[] buttons = new Button[3];
// TODO: initialize each index
for (int i = 0; i < 3; i ) {
buttons[i].setVisible(true);
}