import java.awt.*; import java.applet.*; public class AnimationTextApp extends Applet implements Runnable { String s; static int i; Label lbAnm =new Label("mask"); Thread anim_thread; public void init() { this.setLayout(new FlowLayout(FlowLayout.CENTER,100,100)); this.setSize(300,300); this.setBackground(Color.black); this.add(lbAnm); lbAnm.setSize(200,200); lbAnm.setBackground(Color.black); lbAnm.setForeground(Color.red); } public void start() { if (anim_thread == null) { anim_thread = new Thread(this); anim_thread.start(); } } public void stop() { if (anim_thread == null) { anim_thread = new Thread(this); anim_thread.stop(); } } // public void paint(Graphics g) //{ //// s= "mask"; //g.drawString(s, 50, 50); //} public void run() { while(true) { try { Thread.sleep(1000); } catch (InterruptedException e) { } updateAnimation(); } } public void updateAnimation() { if (i>4) i=0; switch(i) { case 0: s="Welcome!"; break; case 1: s="MOHAMA"; break; case 2: s="MAHER"; break; case 3: s="MAHMOUD"; break; case 4: s="ABDALLAH"; break; } lbAnm.setText(s); lbAnm.setFont(new Font("TimesRoman",Font.BOLD,30)); i++; if (i>4) i=0; } }