I created a simple code for a game similar to Genius, where a random button on a set of 20 buttons starts flashing, but I can not seem to break the color change.
Here is an example, basically I just need the color of the button to change randomly, from 0.3 in 0.3 sec ...
try{
for (int i = 0; i < 255; i++){
//define a proxima cor aleatoria
cor1 = (int)(Math.random()*255)+1;
//deveria gerar o atraso de 0,3s
Thread.sleep(300);
jButton1.setBackground(new Color (cor1,00,00));
}
}catch (InterruptedExcepetion e){}