java
----------------------------
import java.awt.*;
import java.applet.*;
public class UpdateRepaintDemo extends Applet implements Runnable
{
Font f = new Font("標楷體", Font.ITALIC, 25);
Thread t;
String str;
int m, n=0;
public void init()
{
str = "完美的演繹系列" ;
}
public void start()
{
t=new Thread(this);
t.start();
}
public void paint(Graphics g)
{
setBackground(Color.black);
g.setFont(f);
if((n++)%2==1)
{
g.setColor(Color.white);
}
else
{
g.setColor(Color.red);
}
g.drawString(str, 30, 50);
}
public void run()
{
while(true)
{
try
{
t.sleep(200);
}
catch(InterruptedException e)
{}
repaint();
}
}
}

----------------------------

html
----------------------------


動畫





----------------------------

    全站熱搜

    Neo Chao 發表在 痞客邦 留言(0) 人氣()