Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What happened to my Canvas when callSerially

 
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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!