• Post Reply Bookmark Topic Watch Topic
  • New Topic

serviceRepaints()  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
maybe someone has an idea!?!

--------------------------------------------------
public class test extends Canvas {

int paintCount = -1; // because setCurrent(canvas) calls paint() too

public void run() {
try {
Display.getDisplay(this.midlet).setCurrent(this);
repaint();
repaint();
serviceRepaints();
if (paintCount == 0) System.out.println("error");
}

public void paint(Graphics g) {
paintCount++;
System.out.println(paintCount);
}
}
--------------------------------------------------

the result is:
0
error
1

The method paint() is only executed ones for two calls of repaint(). So far so good. Printing the paintCount indicate that paint() did run. Now, why does serviceRepaints() not wait until the paint() method has finished ???
Im running this in simulation with WTK2.0.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!