⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testani.java

📁 介绍有关java的资料 课件 相当一本书籍 里面都是很基础的知识
💻 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 + -