/* PROG 22.12 DEMO OF MEMORYIMAGESOURCE VER 4 DOING ANIMATION */
import java.awt.*;
import java.awt.image.*;
import java.applet.*;
/*
<html>
<applet>
<applet code=“MIS4” width=200 height=200>
</applet>
</html>
*/
public class MIS4 extends Applet implements Runnable
{
int pixData[];
MemoryImageSource misrc;
Image image;
int w, h;
public void init()
{
w = getSize().width;
h = getSize().height;
pixData = new int[w*h];
misrc = new MemoryImageSource(w,h,pixData,0,w);
misrc.setAnimated(true);
image = createImage(misrc);
new Thread(this).start();
}
Figure 22.10 Output screen of Program 22.11 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.