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

What happened to my Canvas when callSerially  RSS feed

 
Jialete Fan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Canvas like this:
public class somec extends Canvas implements Runnable{
.....
public void showNotify(){
running = true;
new Thread(this).start();
}
......
public void run(){
while(running){
....
repaint();
callSerially(this) //Warning here,"this" is not Runnable?!!
.......
}
}
public void paint(Graphics g){
.....
}
}
}
What is the problem here? How can I fix it ?
 
Al Brotherton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As stated in "J2ME in a Nutshell" - "The code to be executed in the event thread should be implimented in the run() method of the Runnable passed to the callSerially() method."
What that says to me is if your "this" is not runnable nothing will be executed
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!