Asteriscos.java_



import javax.swing.JPanel;
import java.awt.Graphics;

// Muestra una serie de asteriscos como puntos suspensivos con
// el efecto de "intentando algo"

public class Asteriscos extends JPanel implements Runnable
{
	Thread Hilo;
	String CAD[] = {"*", "**", "***", "****", "*****", "****", "***", "**", "*"};
	int indice = 0;

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

	public void run( )
	{
		// AQUI VA LA ANIMACION
		// Ciclo infinito
		while(true)
		{
			try { Thread.sleep(500); }
			catch(InterruptedException r)
			{// CODIGO PARA LA ATENCION A LA INTERRUPCION
			}
			indice ++;
			if (indice == CAD.length) indice = 0;
			repaint();
		}
	}

	public void paint(Graphics G)
	{
		G.clearRect(0, 0, 400, 250);
		G.drawString(CAD[indice], 100, 100);		// (cadena, x, y)
	}
}