Results 1 to 9 of 9
  1. #1
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default 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! :)

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default Re: Tic Tac Toe discussion

    how to make each box
    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.
    when the mouse will stand on x box, the background color of x will be changed.
    You can use the mouse listeners to see where the mouse is and how long it has been there.

  3. #3
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default Re: Tic Tac Toe discussion

    Quote Originally Posted by Norm View Post
    Swing component
    Which?

    And why not an object chain?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default Re: Tic Tac Toe discussion

    JPanel or JLabel or JButton

    What is an "object chain"?
    How does an "object chain" display as GUI?

  5. #5
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default 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".

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default 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.

  7. #7
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default 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?

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default Re: Tic Tac Toe discussion

    You could have a linked list of nodes that contain references to JPanels.

  9. #9
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default Re: Tic Tac Toe discussion

    Ok, thanks for your advices.
    can be locked.

Similar Threads

  1. how can i implement discussion forum in java
    By munir hussain in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 01-17-2010, 03:41 PM
  2. Discussion: JVM hangs
    By Arica in forum Advanced Java
    Replies: 5
    Last Post: 06-29-2009, 04:29 AM
  3. Security in HttpSession [Discussion]
    By mtz1406 in forum Java Servlet
    Replies: 3
    Last Post: 11-19-2008, 12:37 AM
  4. Creating Forum discussion using JAVA
    By cahyasuria84 in forum New To Java
    Replies: 2
    Last Post: 10-25-2008, 03:15 PM
  5. General Discussion on Abstract
    By sanjeevtarar in forum Advanced Java
    Replies: 15
    Last Post: 05-06-2008, 06:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •