// Program with Banner applet.
import java.awt.*;
import java.applet.*;/*
<applet code="Applet03" width="300" height="50">
</applet>
*/public class Applet03 extends Applet implements
Runnable
{
String msg = "Java Programming Examples";
Thread t = null;
boolean flag;
public void init()
{
setBackground(Color.yellow);
setForeground(Color.red);
}public void start()
{
t = new Thread(this);
flag = false;
t.start();
}public void run()
{
char ch;
for( ; ; )
{
try
{
repaint();
Thread.sleep(250);
ch = msg.charAt(0);
msg = msg.substring(1, msg.length());
msg += ch;
if(flag)
break;
}
catch(InterruptedException e)
{ }
}
}public void stop()
{
flag = true;
t = null;
}public void paint(Graphics g)
{
g.drawString(msg, 50, 30);
}
}
Output:D:\Java>appletviewer Applet03.java