Page 4 of 4 FirstFirst ... 234
Results 61 to 74 of 74
  1. #61
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    I changed it but it didnt clear anything

    Java Code:
    public void clearTheBoard() {
    
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
        cells[i][j] = new Cell();

  2. #62
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Sorry to be a curmudgeon here, but the pattern of behavior that will get you to learn Java is this:
    find error
    think about code
    try to debug on own,
    try to fix error.

    Not this:
    find error
    post error on forum
    find another error
    post error on forum.

  3. #63
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    well they asked to see the error so they could help me..can you help me there are no errors it just wont clear the cells like we want it to.

  4. #64
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    That's called a logical error. I want to help you, but I feel like I am holding your hand a bit too much. As fubar said, self testing is the best way to learn it(and remember it).

  5. #65
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    well i've tested everything you suggested and it still doesnt work so..

  6. #66
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    i still havent solved this problem..dont know what the problem is..there are no errors or anything but the clear button doesnt clear the board

  7. #67
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    What happens when you add repaint() after resetting the board?

  8. #68
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    i have a re-paint further down in the code..

    Java Code:
    public void setToken(char c) { // Set a new token
        token = c;
        repaint();

  9. #69
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

    Default

    That repaint() is only called when you call the setToken() method.

    EDIT: Ok from all these questions, you sound like a complete newbie. Please read a book or some tutorials and play with some simpler code. Do not copy and paste code you find and start asking a million questions.

  10. #70
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Did you add it to the listener? It's just a thought of something to try.

  11. #71
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    Ya i did add it...still nothing though :(

  12. #72
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Unfortunately you may have to solve this one yourself. Try looking at code you had that would successfully paint the start and change things until it no longer paints, then you will hopefully know which line does the painting. From there you will have to include this line in your setup method. You need to sit back and think about it, we can help you, but the real work needs to be on you if you expect to learn something.

  13. #73
    Ryan10 is offline Senior Member
    Join Date
    Mar 2011
    Posts
    144
    Rep Power
    0

    Default

    i think i've learned a lot throughout this process only i know what i have learned i've been working on this code for 2 weeks now im not going to "sit back" and look at this code anymore its pretty sickening to look at now.

  14. #74
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I know how you feel, I have felt the same way before. You just need to think logically. You want the click of a button to set the board to look as it did upon launch. Think logically about different things that might work to accomplish this. You had the board setup correct earlier so you are halfway there. You need to figure out which lines of code set everything up correctly and use them when the button is clicked.

Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. Clear/Reset Button Problem
    By Ryan10 in forum New To Java
    Replies: 10
    Last Post: 04-12-2011, 03:04 PM
  2. Solving a maze in java
    By kuro in forum New To Java
    Replies: 4
    Last Post: 04-11-2011, 11:41 PM
  3. Clear Radio Button
    By Reborn in forum New To Java
    Replies: 6
    Last Post: 07-25-2010, 05:21 PM
  4. Solving a Maze
    By bdario1 in forum New To Java
    Replies: 4
    Last Post: 04-14-2010, 12:02 AM
  5. I need help solving this problem.
    By Felicia in forum New To Java
    Replies: 5
    Last Post: 03-04-2010, 08:40 PM

Posting Permissions

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