IntelliJ Java IDE
The moose likes Game Development and the fly likes JLabel help pls Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "JLabel help pls" Watch "JLabel help pls" New topic
Author

JLabel help pls

rui natal
Greenhorn

Joined: Jun 12, 2006
Posts: 1
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
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
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.


Java API Documentation
The Java Tutorial
 
 
subject: JLabel help pls
 
Threads others viewed
BorderLayout
initializing
Locating WSDL address on server
"add" method
JLabel
developer file tools