import java.applet.*;
import java.awt.*;

class TPane extends Canvas implements Runnable {
 String text;
 Thread me;
 boolean inc= true;
 int index;
 Font fonts[]= new Font[10];

 TPane(String text) {
  this.text= text;
  for( int i=0; i<10; i++) fonts[i]= new Font("Arial",Font.PLAIN,10+i);
 }


 public Dimension minimumSize() {
  return new Dimension( 150,100);
 }

 public Dimension preferredSize() {
  return new Dimension( 150,100);
 }

 public void paint( Graphics g) {
  Font temp= g.getFont();
  g.setFont( fonts[index]);
  FontMetrics f= g.getFontMetrics();
  Dimension s= size();

  int x= (s.width- f.stringWidth(text))/2;
  int y= (s.height- f.getHeight()- f.getDescent())/2;
  g.drawString( text,x,y);
  g.setFont( temp);
 }

 public void run() {
  while( me.isAlive()) {
   { try{ me.sleep(100);} catch(Exception e) {} }
    repaint();
    if( inc)
     if( index<9) index++;
     else inc=false;
    else
     if(index>0) index--;
     else inc= true;
   }
 }

}


public class Test extends Applet {
 TPane pane;
 Thread th;
 boolean stopped= false;

 public void init() {
  pane= new TPane( getParameter("text"));
  pane.me= th= new Thread( pane); 
  add( pane);
  show();
 }

 public void start() {
  if( stopped) th.resume();
  else th.start();
 }

 public void stop() {
  th.suspend();
  stopped= true;
 }  

 public void destroy() {
  th.stop();
 }

}
