Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

There is an issue which appears while running the application. It is not an Exception, but the desired UI change is not been implemented.

While debugging to find the code which should be changed to fix this problem, the UI changes can be seen correctly, To be specific, if we put one breakpoint in the class where it is called, and press the Continue in NetBeans, the problem occurs. But if we step over to the next lines and try to see the state at the end of the debug, the component seems to work perfectly.

How can these kind of issues be resolved?

share|improve this question

marked as duplicate by Doc Brown, gnat, Walter, Glenn Nelson, Ozz Feb 19 '13 at 13:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
try to add some log statements. If you debug, the GUI might be repainted if you switch windows from your application to your IDE. –  keuleJ Feb 19 '13 at 12:14

1 Answer 1

This is often caused by concurrent processes (not OS-level processes, just... general things that happen in your application: events, threads, input/output etc.) which both affect the rendering in some way. This leads to different behaviour depending on the order in which they happen, and debugging and breaking often interferes with that.

One good strategy is to replace stepping through the debugger with more logging - this takes much less time and therefore is much more likely to leave things as they are while still giving you more information.

Ultimately, though, nothing beats understanding what the system actually does. Is there one component, and one only, which should be responsible for maintaining the state of the UI? (Usually there should.) If so, why is it getting inconsistent commands in the first place? Obviously, logging can often help answering these questions as well.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.