i'm making a tic-tac-toe game and I need to know when the player clicks any of the buttons becausa I need to call a function that will make the computer play next, i have a class named Casa with a JButto in a JLabel and i have another class that creats 9 Casa and puts them in a JLabel and know I need to know when someone clicks one of those 9 Casa, no matter wich because in the class Casa i already change the image of the button when he's clicked...
I appreciate any help you can give me
PS: sorry about the bad english, i'm portuguese
Krisp Sigh
Greenhorn
Joined: May 11, 2006
Posts: 9
posted
0
Follow these four steps for your game.
1)when u click on the button first check if its already occupied or not if its not assigned any value put the relevant image on the button.
2)now check for the win condition for the user. ie. 3 in a row or 3 in diagonally
3)choose a place to put the Computer's turn
4)now check if computer wins the game
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
Please post some code snippets. This will give us the details we need to help understand what you are doing. We will be glad to help you from there.