25-04-2016, 02:28 PM
PROGRAM TO DISPLAY A MOVING BANNER import java.awt.*;
import java.applet.*;
publicclass simpleBanner extends Applet implements Runnable
{
String msg=" A Simple Moving Banner. ";
Thread t=null;
int state;
boolean stopflag;
publicvoid init()
{
setBackground(Color.yellow);
setForeground(Color.red);
}
publicvoid start()
{
t = new Thread(this);
stopflag=false;
t.start();
}
publicvoid run()
{
char ch;
for(;{
try{
repaint();
Thread.sleep(250);
ch=msg.charAt(0);
msg=msg.substring(1,msg.length());
msg=msg+ch;
if(stopflag)
break;
}catch(InterruptedException e) {}
}
}
publicvoid stop()
{
stopflag=true;
t=null;
}
publicvoid paint(Graphics g)
{
g.drawString(msg,50,30);
showStatus("Simple Banner");
}
}USING APPLET
https://seminarproject.net/Thread-progra...#pid243259
https://seminarproject.net/Thread-progra...ing-applet
import java.applet.*;
publicclass simpleBanner extends Applet implements Runnable
{
String msg=" A Simple Moving Banner. ";
Thread t=null;
int state;
boolean stopflag;
publicvoid init()
{
setBackground(Color.yellow);
setForeground(Color.red);
}
publicvoid start()
{
t = new Thread(this);
stopflag=false;
t.start();
}
publicvoid run()
{
char ch;
for(;{
try{
repaint();
Thread.sleep(250);
ch=msg.charAt(0);
msg=msg.substring(1,msg.length());
msg=msg+ch;
if(stopflag)
break;
}catch(InterruptedException e) {}
}
}
publicvoid stop()
{
stopflag=true;
t=null;
}
publicvoid paint(Graphics g)
{
g.drawString(msg,50,30);
showStatus("Simple Banner");
}
}USING APPLET
https://seminarproject.net/Thread-progra...#pid243259
https://seminarproject.net/Thread-progra...ing-applet