• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RepaintManager is spamming paintDirtyRegions

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic