📄 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){}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -