I have a random number method and random color method set up. I have 28 buttons and they all are named button_number. The random number picks the button. I have some basic code that obviously doesn't work because I can't change the background of the string but I don't know where to go from here.
static Random random = new Random();
static int rand1 = RandomRange.showRandomInteger(1, 28, random);
static String num = Integer.toString(rand1);
static String button = ("button_" + num);
button.setBackground(randomColor());
Aucun commentaire:
Enregistrer un commentaire