I am trying to narrow down why my JComponent is not redrawing. It is odd in that I can get redraw to work on mouse press and release, but not on drag. Is there a way to print out the EventQueue or verify that the PaintEvent was carried out or dumped? Let me know, thanks.
Asked
Active
Viewed 74 times
2
-
1Can you give us a reduced version of your code that provokes your problem? Ideally, a version that we could compile and run locally. – Irfy Mar 28 '12 at 21:00
-
You've likely got a bug in your code. I agree with irfy's recommendation above to show us your code. I've done println's from within the paintComponent method, which sometimes can help, but hopefully you've got no program logic within your paint or paintComponent method, and so I think you're better off debugging the other methods. – Hovercraft Full Of Eels Mar 28 '12 at 21:32
-
1You can always push you own EventQueue that overrides the dispatchEvent method and does Syserr to the console of the event class, source, etc... – Guillaume Polet Mar 28 '12 at 21:45
-
See this [example](http://stackoverflow.com/a/3158409/230513). – trashgod Mar 28 '12 at 22:19
2 Answers
1
There's no way to print out jobs on the EventQueue, at least not that I know of.
Are you sure you are calling repaint()? Please note that calling repaint does not guarentee that your component will be repainted immediately or in any timely manner.
My guess is that if you are calling repaint, the problem may be that you are never letting go of the UI thread. If you are waiting on the GUI thread and not releasing, your GUI will never refresh

ControlAltDel
- 33,923
- 10
- 53
- 80
1
You can add logging to your application. Consider using LogBack
Interesting discussion here about logging for Swing applications as well.

sikander
- 2,286
- 16
- 23