I'm having an issue with my GUI when I try to change the color of a button after 2 seconds when its has been clicked. What I want to do is to click on a white square button, then a color comes up, after 2 seconds I want it to return to it's original color (white). How can achieve this?
My code on click:
cards[index].setBackground(cards[index].getTrueColor());
try
{
Thread.sleep(2000);
cards[cardPos.get(0)].setBackground(Color.white);
}
catch(Exception e) {}
So this goes back to color white, but in an instance, doesn't wait to seconds. Really appreciate a little help here. Thanks!