j priebe

Greenhorn
+ Follow
since Sep 08, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by j priebe

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.
14 years ago