-
Help Error
import java.applet.*;
import java.awt.*;
public abstract class banner extends Applet implements Runnable {
String msg="My New Banner";
Thread t=null;
int state;
boolean stop;
public void init(){
setBackground(Color.RED);
setForeground(Color.black);
}
public void start(){
t=new Thread(this);
t.start();
stop=false;
}
public void run(){
char ch;
for(;;){
try{
repaint();
Thread.sleep(1000);
ch=msg.charAt(0);
msg=msg.substring(1,msg.length());
msg+=ch;
if(stop){
break;
}
}catch(InterruptedException e){
}
}
}
public void stop(){stop=true;
t=null;
}
public void paint(Graphics g){
g.drawString(msg, 20, 56);
}
}
-
this gives the error that applet not initialize
-
Well, of course it can't be initialised when you've declared the Class abstract.
-
-
And don't forget to inclose the java code with code tags next time :)