File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

j2me repaint() quetion

 
ying lam
Ranch Hand
Posts: 85
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a j2me repaint() quetion. I apprecaite if you can help me with that.

In my code, I call
repaint(x1, y1, w1, h1);

...

repaint(x2, y2, w2, h2);

...
repaint(x3, y3, w3, h3);

...
repaint(x4, y4, w4, h4); // note: x1 , x2, x3, x4 are all different values.

even though repaint() is call a-sync, I should still see paint() get called 4 times, right?

From my debugging, I see the no of paint() is less than the no of called i made to repaint().

Do you have any idea why is that?

Thank you.
 
Eduardo Marques
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, paint() is not necessarily called the number of times you call repaint(). Multiple repaint() requests may be merged into just one call to paint().

To ensure synchronized painting you can either use:
1) Canvas.serviceRepaints()

2) use GameCanvas which does everything Canvas does and provides the flushGraphics() call
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic