G
Gast
Gast
hallo,
ich hab ein applet programmiert, aber die methode start() wird nie ausgeführt, warum??
hier ist der vereinfachte code
bitte helft mir!
danke für eure tipps
ich hab ein applet programmiert, aber die methode start() wird nie ausgeführt, warum??
hier ist der vereinfachte code
Code:
import java.awt.*;
import java.applet.*;
public class Test extends Applet implements Runnable{
protected Thread secondThread;
int x = 10;
protected Graphics paintBox;
public void init() {
secondThread = new Thread(this);
secondThread.start();
paintBox = getGraphics();
}
public void start() {
paintBox.drawLine(0,200,100,200);
}
public void paint(Graphics g) {
g.drawLine(x,10,x+90,100);
}
public void run() {
while(true) {
x++;
paint(paintBox);
try{
Thread.sleep(10);
} catch(Exception e) {}
}
}
}
danke für eure tipps