This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Murach's Java Programming and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

serviceRepaints()  RSS feed

 
j priebe
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!