Jump to content

  • Log In with Google      Sign In   
  • Create Account


Finding logic error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 nitishk   Members   -  Reputation: 161

Like
0Likes
Like

Posted 31 March 2013 - 10:21 AM

I have spent about 2 hours now trying to find this one logic error in my code. The problem is, I have 5 JLabels and in each there is an ImageIcon. Sometimes a JLabel will draw, sometimes it won't. I am using eclipse. Is there any good ways to debug logic errors using either some debug tools in eclipse or some programming technique that will help me find the error. Getting really frustrated at myself right now :/



Sponsor:

#2 unbird   Crossbones+   -  Reputation: 4973

Like
0Likes
Like

Posted 31 March 2013 - 12:22 PM

Interactive applications like GUIs are hard to debug with an integrated debugger: a simple breakpoint disturbs a GUIs control flow and can trigger events which without debugger wouldn't occur. I don't know about eclipse, but what I did when I programmed GUIs was dumping relevant info right in the GUI (label, textbox): Internal states, event trigger counts etc.

 

If all fails, there's always log-files. The latter has the advantage that you can detect race conditions (what did occur after what?).


Edited by unbird, 31 March 2013 - 12:27 PM.


#3 BCullis   Crossbones+   -  Reputation: 1813

Like
0Likes
Like

Posted 01 April 2013 - 11:51 AM

I have spent about 2 hours now trying to find this one logic error in my code. The problem is, I have 5 JLabels and in each there is an ImageIcon. Sometimes a JLabel will draw, sometimes it won't. I am using eclipse. Is there any good ways to debug logic errors using either some debug tools in eclipse or some programming technique that will help me find the error. Getting really frustrated at myself right now :/


Can you post the code that sets up the JLabels?
Do you change the value of the JLabels and/or their ImageIcon data after initialization?

I recommend using System.out.println debug statements if you're using Eclipse (just to surround suspected problems and check values). The console is right there in the IDE, it might get spam-y due to the redraw loops of the GUI, but it could highlight your problem.
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS