CardTst.java

import java.awt.*;
import java.applet.Applet;

public class CardTst extends Applet {
    Panel p;
    CardLayout CL;

    public void init() {
        p=new Panel();
        p.setLayout(CL=new CardLayout());
        int i;
        for (i=1;i<11;i++) {
            Image imgs=getImage(getDocumentBase(),"img/T"+i+".gif");
            p.add(new ImgCanv(imgs));
        }
        setLayout(new BorderLayout());
        add("Center",p);
        add("North",new Button("back"));
        add("South",new Button("next"));
    }

    public boolean action(Event e, Object o) {
        if ("next".equals(o))
            CL.next(p);
        else
            CL.previous(p);
        return true;
    }
}

ImgCanvƒNƒ‰ƒX

class ImgCanv extends Canvas {
    Image imgs;

    public ImgCanv(Image i) {
        imgs=i;
    }
    public void paint(Graphics g) {
        g.drawImage(imgs,0,0,size().width,size().height,this);
    }
}