Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • 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.
 
It runs on an internal combustion engine. This ad does not:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!