import java.applet.*;
import java.awt.*;

public class Laufschrift extends Applet implements Runnable
{
Thread m_Laufschrift = null;

int m_size = 12;
Font m_font;
int m_pics_sec = 20;
Image m_image1;
Image m_image2;
Graphics m_graphics1;
Graphics m_graphics2;
int m_breite;
int m_hoehe;
int m_min;
int m_max;
int m_current;


public Laufschrift()
{
}

public String getAppletInfo()
{
return "Name: Laufschrift\r\n" +
"Author: BN";
}


public void init()
{
resize(160, 20);
m_breite = 160;
m_hoehe = 20;

m_image1 = this.createImage(m_breite, m_hoehe);
m_graphics1 = m_image1.getGraphics();

m_image2 = this.createImage(m_breite, m_hoehe);
m_graphics2 = m_image2.getGraphics();

m_font = new Font("Helvetica", Font.PLAIN, m_size);
this.setFont(m_font);
m_min = -m_breite;
m_max = m_breite;
m_current = m_max;

setLayout(null);
setSize(160,20);
}

public void destroy()
{
}

public void update(Graphics g)
{
paint(g);
}

public void paint(Graphics g)
{
if(m_image1!=null){

m_graphics1.setColor(Color.black);
m_graphics1.fillRect(0, 0, m_breite, m_hoehe);
m_graphics1.setColor(Color.green);
m_graphics1.drawString("abcdefghijklmnopqrstuvwxyz", m_current, 12);

m_current--;
if(m_current<m_min){
m_current = m_max;
}

g.drawImage(m_image1, 0, 0, null);
}
}

public void start()
{
if (m_Laufschrift == null)
{
m_Laufschrift = new Thread(this);
m_Laufschrift.start();
}
}

public void stop()
{
if (m_Laufschrift != null)
{
m_Laufschrift.stop();
m_Laufschrift = null;
}
}

public void run()
{
while (true)
{
try
{
Thread.sleep(m_pics_sec);
repaint();
}
catch (InterruptedException e)
{
stop();
}
}
}

}