home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet 1996 World Exposition
/
park.org.s3.amazonaws.com.7z
/
park.org.s3.amazonaws.com
/
Japan
/
128KTTH
/
tky103
/
anime1.java
< prev
next >
Wrap
Text File
|
2017-09-21
|
741b
|
48 lines
import java.awt.*;
public class Anime1 extends java.applet.Applet implements Runnable
{
Image imgA, imgB;
int img;
Thread t;
public void init() {
imgA = getImage( getDocumentBase(), "awa.gif" );
imgB = getImage( getDocumentBase(), "onp.gif" );
img = 0;
t = null;
}
public void start() {
if( t == null ) {
t = new Thread( this );
t.start();
}
}
public void stop() {
if( t != null ) {
t.stop();
t = null;
}
}
public void run() {
while( t != null ) {
try {
t.sleep( 300 );
}
catch( InterruptedException e ){}
repaint();
img = 1 - img;
}
}
public void paint( Graphics g ) {
if( img == 0 )
g.drawImage( imgA, 0, 0, this );
else
g.drawImage( imgB, 0, 0, this );
}
}