View Single Post
  #7 (permalink)  
Old 02-14-2007, 11:15 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 3,211
Last Blog:
Passwords
Credits: 842
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

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.
Reply With Quote