📄 testani.java
字号:
import java.awt.*;import java.applet.Applet;public class testani extends Applet implements Runnable { Thread runner; Image imgs[]; int high, y1, y2, y3; public void init() { high = size().height; y1 = high; y2 = high*2; y3 = high*3; imgs = new Image[10]; for(int i=0;i<3;i++) imgs[i]=getImage(getCodeBase(),getParameter("image"+(i+1))); } public void start() { runner = new Thread(this); runner.start(); } public void stop() { runner.stop(); runner = null; } public void run() { while (runner != null) { try { Thread.sleep(100); repaint(); y1--; if(y1 == 0) { Thread.sleep(3000); y2=high; } y2--; if(y2 == 0) { Thread.sleep(3000); y3=high; } y3--; if(y3 == 0) { Thread.sleep(3000); y1 = high; } } catch (InterruptedException e){} } } public void paint(Graphics g) { g.drawImage(imgs[0], 0, y1, this); g.drawImage(imgs[1], 0, y2, this); g.drawImage(imgs[2], 0, y3, this); } public void update(Graphics g) { paint(g); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -