Beispiel zur Erzeugung eines Threads
class CPanel extends Panel implements Runnable
{
...
Thread t;
// "HauptThread"
public void run()
{
String Auswahl_Text;
while (true)
{
try
{
t.sleep(100);
}
catch(InterruptedException e)
{
}
x++;
if (x == Laufschrift_Text.length()) x = 0;
Auswahl_Text = Laufschrift_Text.substring(0,x);
Laufschrift.setText(Auswahl_Text);
}
}
public CPanel(String text)
{
// Thread Laufschrift starten
if (t==null)
{
t = new Thread(this);
t.start();
}
...
}
}