📄 flash.java
字号:
/*
* @(#)Flash.java 1.0 06/03/03
*
* You can modify the template of this file in the
* directory ..\JCreator\Templates\Template_2\Project_Name.java
*
* You can also create your own project template by making a new
* folder in the directory ..\JCreator\Template\. Use the other
* templates as examples.
*
*/
import java.awt.*;
import java.applet.*;
public class Flash extends Applet implements Runnable{
Image images[];
Thread thread;
int frame;
public void init() {
int i;
images=new Image[13];
thread=null;
for(i=0;i<images.length;i++)
{
images[i]=getImage(getDocumentBase(),(i+".jpg"));
}
}
public void start()
{
if(thread==null)
thread=new Thread(this);
thread.start();
}
public void stop()
{
if(thread!=null)
thread.stop();
thread=null;
}
public void run()
{
while(true)
{
frame++;
frame%=(images.length);
repaint();
try{
Thread.sleep(10);
}
catch(InterruptedException e)
{}
}
}
public void update(Graphics g)
{
g.drawImage(images[frame],20,30,50,50,this);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -