I read this: http://www.dmc.fmph.uniba.sk/public_html/doc/Java/ch10.htm to help me gain an understanding of runnables and the applet and decided to test out this code. However, within the thread, the repaint() method isn't being called.
public class test extends Applet implements Runnable{
int hello;
public void start(){
Thread run = new Thread(this);
run.start();
}
public void run() {
for (int i = 0; i < 30; i++){
hello = i;
repaint();
}
}
public void paint(Graphics g){
System.out.println(hello);
}
}
I'd expect my results to be something like:
0
1
2
...
29
However, instead I get:
29
29
and I don't understand why. Is it because I don't have a stop() method?