±Û¾´ÀÌ :ÃÖÈ¿Á¤ 1998³â 6¿ù 29ÀÏ 16:40:22
In Reply to: ÀÌ ¾ÖÇø´ÀÇ ¹®Á¦Á¡ÀÌ ¹«¾ùÀÎÁö.. posted by ÃÖÈ¿Á¤ on 1998³â 6¿ù 29ÀÏ 15:10:53:
Äڵ带 ´ÙÀ½°ú °°ÀÌ ¼öÁ¤Çß´õ´Ï ÇØ°áÀÌ µÆ´Âµ¥..
paint¸Þ¼Òµå¿¡¼ ¿Ö ¹è¿À» ÀνÄÇÏÁö ¸øÇÒ±î....
À妽º¸¦ ¸ø¾Ë¾Æ¸Ô¾î¼ ±×·¯´ÂÁö.. Àß ¸ð¸£°Ú³×¿ä...
import java.awt.*;
import java.applet.*;
import java.lang.*;
public class TestLoadimage extends java.applet.Applet implements Runnable {
int imgidx = 0;
Image imgs[] = new Image[10];
Image currentimg;
Thread mythread;
public void run() {
for(int i=0, j=1; i<10; i++, j++) imgs[i] = getImage(getCodeBase(), "t" + j + ".gif");
while ( imgidx < 10) {
currentimg = imgs[imgidx];
repaint();
try { Thread.sleep(1000);
} catch(InterruptedException e) {}
imgidx++;
}
}
public void start() {
if(mythread == null) {
mythread = new Thread(this);
mythread.start();
}
}
public void stop() {
if(mythread != null) {
mythread.stop();
mythread = null;
}
}
public void paint(Graphics g) {
g.drawImage(currentimg, 10, 10, this);
}
}