Whenever the button is pressed, I want to set a certain colour. Right now the user can write an int and the corresponding colour is presented (without typing the corresponding int every time). I want to change this though. Every time the user clicks the button, the next colour shall be presented, but I don't know how to rewrite the code. I tried a do while and for loop, but I had problems with the variable used in lambda expression (which apparently should be final)?
board.setButton2Text("Select");
board.setButton2Action(() -> {
int c = 0;
while(!(c > 0 && c < 7)) {
try {
c = IO.inputInt("Type an int ranging from 1 to 6");
} catch (RuntimeException e) {
continue;
}
}
currentCode.setColor(selectedCircle, c);
drawCode(X_START, Y_START + LINE_SPACING * (6 - currentTry), currentCode);
});
Right now it looks like this
