Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RepaintManager is spamming paintDirtyRegions  RSS feed

 
Kari Nordmann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a small game where I need to update the graphics often.
I've got the double buffering right afaik, but there's a problem with RepaintManager spamming paintDirtyRegions so much that the graphics are flickering.
I tried googling for paintDirtyRegions and RepaintManager, but I didn't see any useful information on this issue. I don't understand why the method is spammed so much and I have no idea how to deal with it. I'm not even sure if this issue is related to paint() or something else. The problem did go away when I disabled paint(), but the problem doesn't go away when I stop calling for paint() or repaint anywhere.

Can anyone help me get reduce the spam and remove the flickering? Have I done something wrong, or do I lack something in the application?
I can post my code when I know which part is useful for you to see My paint() is pretty long with lots of drawstring, fillrect and drawimage.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have I done something wrong, or do I lack something in the application?

Probably, but your post certainly lacks the information needed for anyone to offer meaningful help. For starters, you haven't even mentioned the toolkit you're using. Is this AWT, Swing... something else?

At a guess, you might be doing a state update in a painting method override that in turn invokes a repaint() somewhere in the same component hierarchy.
 
Campbell Ritchie
Marshal
Posts: 55745
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please show the line where you create the Component you are painting on, too. Have you done anything about double buffering?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!