Java labels support HTML code, so for example in my code, I could do something like this:
Code:
if(count % 2 == 0){
letter = "<HTML><font color=red>O</font></HTML>";
} else {
letter = "<HTML><font color=blue>X</font></HTML>";
}
And when an O is suppose to be printed on the JButton it is red and when an X is suppose to be printed on the JButton it is blue. You can also set the background of the JButtons by calling the setBackground(Color c) method, and an example in my code would be
Code:
pressedButton.setBackground(Color.WHITE);
and when the button is pressed it sets the background color to white. This should get you started.