Results 1 to 9 of 9
Thread: Tic Tac Toe discussion
- 12-14-2011, 05:18 PM #1
Senior Member
- Join Date
- Aug 2011
- Posts
- 248
- Rep Power
- 2
Tic Tac Toe discussion
Hello guys,
I already created a tic tac toe game, all the fields was buttons, 9 buttons.
I want to create a new one without any button.
The game will be on the whole screen.
So for example, top-left box will be width/3 and height/3
top-middle box (2*width)/3 and height/3
middle-left box width/3 and (2*height)/3 and so on..
My question is how to make each box(It's not really a box.. it's only on our mind) to become a reall declared box/field/square (call it how ever you want).
I want when the mouse will stand on x box, the background color of x will be changed.
Maybe object chain that each chain holds the x and y of it?and then create a method that checks on which object the mouse is standing on?
I opened this thread to hear some ideas so you'r welcome to share with me! :)
- 12-14-2011, 05:45 PM #2
Re: Tic Tac Toe discussion
You can use a Swing component for each box or you can have one area that your subdivide into the 9 areas and cdo your own drawing of lines to show the boxes. The first would be easier.how to make each box
You can use the mouse listeners to see where the mouse is and how long it has been there.when the mouse will stand on x box, the background color of x will be changed.
- 12-14-2011, 09:40 PM #3
Senior Member
- Join Date
- Aug 2011
- Posts
- 248
- Rep Power
- 2
- 12-14-2011, 10:46 PM #4
Re: Tic Tac Toe discussion
JPanel or JLabel or JButton
What is an "object chain"?
How does an "object chain" display as GUI?
- 12-14-2011, 11:15 PM #5
Senior Member
- Join Date
- Aug 2011
- Posts
- 248
- Rep Power
- 2
Re: Tic Tac Toe discussion
Object chain, is a chain of objects .. collections.
I will create 9 box objects that each one of them will hold the X and Y of the box and the next Box for example:
b1
x = 150;
y = 750;
nextBox = b2;
b2
x = 340;
y = 710;
nextBox = b3;
etc ..
I think the precise term is "Integration Objects".
- 12-14-2011, 11:18 PM #6
Re: Tic Tac Toe discussion
Looks like a linked list.
It has nothing to do with what is displayed in a GUI other than a place to hold references to the components that are being displayed in the GUI.
- 12-14-2011, 11:40 PM #7
Senior Member
- Join Date
- Aug 2011
- Posts
- 248
- Rep Power
- 2
Re: Tic Tac Toe discussion
Linked list, that's it! It's very hard for me to translate it from my language to english.
So what about JPanel linked list?
- 12-15-2011, 12:05 AM #8
Re: Tic Tac Toe discussion
You could have a linked list of nodes that contain references to JPanels.
- 12-15-2011, 02:48 PM #9
Senior Member
- Join Date
- Aug 2011
- Posts
- 248
- Rep Power
- 2
Similar Threads
-
how can i implement discussion forum in java
By munir hussain in forum JavaServer Faces (JSF)Replies: 1Last Post: 01-17-2010, 03:41 PM -
Discussion: JVM hangs
By Arica in forum Advanced JavaReplies: 5Last Post: 06-29-2009, 04:29 AM -
Security in HttpSession [Discussion]
By mtz1406 in forum Java ServletReplies: 3Last Post: 11-19-2008, 12:37 AM -
Creating Forum discussion using JAVA
By cahyasuria84 in forum New To JavaReplies: 2Last Post: 10-25-2008, 03:15 PM -
General Discussion on Abstract
By sanjeevtarar in forum Advanced JavaReplies: 15Last Post: 05-06-2008, 06:16 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks