Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Finding logic error

4: Adsense

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   

163
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 :/



#2 unbird   Members   

8307
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   Members   

1955
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 (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)





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.