Results 1 to 7 of 7
  1. #1
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default The code isnt working unless I add print statements at diffrent points!:confused:

    Hai!
    I got some peice of code.
    Too big to poste here + its like 5 packages to it too incl 20 images..
    So anyways.
    The awsomely wierd problem is this:
    The code sometime stops working.
    And the only way get it back up working is to add
    System.out.println(hopefully the variable that is messing it up)
    Its quite enojing..
    I dont know why Im getting this..
    Any hints?
    First I solved it by writting "a".equals(blah) instad of "a" == blah
    But now its back, and it wont go away..

    Any hints on where to look?

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Describe "isn't working".

    If a Sysout affects program flow then look for block with missing braces. e.g in
    Java Code:
    if(readyToCallMethod) 
        System.out.println("About to call method");
        callMethod();

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

    Default

    Do some debugging with a debugger. I hope you aren't expecting any more specific advice on this without code. You first will have to isolate your problem with the debugger, then post the code.

  4. #4
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default

    Thats the problem..
    I dont get any errors or anything..
    The game works perfect except on some points..

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

    Default

    Again, use a debugger and follow the state of the program as it is being run. It may not be throwing errors, but if it is messing up, it has a bug(s). It will be next to impossible for us to figure out where the bugs are based on descriptions, and no one is going to want to pour through pages of code. So you are going to have to do some sleuthing, pure and simple. Much luck!

  6. #6
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default

    Ty
    I'v found out though whats causing it..
    I think it is the: addKeyListener that doesnt work right..
    When the game is created, it makes a gui with all stuff on, and all animations and pictures loaded.
    And just before addKeyListener is getting called the window change size (to fix another glitch)
    And therefore I belive that something is not be set up right, Im calling this too earli and should use somekind of wait mechanism..

    Am I right or..?

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,791
    Rep Power
    19

    Default

    You sure you're not trying to do GUI changes outside of the EDT?

Similar Threads

  1. Loop System print or println statements
    By Singing Boyo in forum New To Java
    Replies: 6
    Last Post: 03-22-2009, 03:52 AM
  2. Replies: 0
    Last Post: 11-25-2008, 09:24 AM
  3. Dubugger points to incorrect source code
    By gdias in forum Eclipse
    Replies: 0
    Last Post: 09-02-2008, 08:07 PM
  4. Replies: 2
    Last Post: 08-24-2008, 12:30 AM
  5. confused code
    By creativehacker in forum New To Java
    Replies: 6
    Last Post: 07-02-2007, 08:10 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
  •