?? imageapplet.java
字號:
import java.applet.Applet;
import java.awt.*;
public class ImageApplet extends Applet
{
int num = 5;
Image imgs[];
public void init()
{
imgs = new Image[num];
for(int i = 0; i < num; i++)
{
imgs[i] = getImage(getDocumentBase(), "images/" +"a" + (i+1)+ ".jpg");
}
this.setBackground(Color.white);
}
public void paint(Graphics g)
{
while(true)
{
for(int i=0;i<num;i++)
{
g.drawImage(imgs[i],0,0,this);
Thread t = new MyLater();
t.start();
try
{
t.join();
}catch(InterruptedException e){}
g.clearRect(0,0,this.getBounds().width,this.getBounds().height);
}
}
}
}
class MyLater extends Thread
{
public void run()
{
try
{
this.sleep(1000);
}catch(InterruptedException e){}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -