import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class tech0026 extends Applet{
CardLayout layout = new CardLayout();
Panel cpanel = new Panel();
Panel bpanel = new Panel();
public void init(){
setLayout(new BorderLayout());
bpanel.add(new Button("ページ1"));
bpanel.add(new Button("ページ2"));
bpanel.add(new Button("ページ3"));
add("North", bpanel);
cpanel.setLayout(layout);
cpanel.add("card 1", new Label("ページ1です。"));
cpanel.add("card 2", new Label("ページ2です。"));
cpanel.add("card 3", new Label("ページ3です。"));
add("Center", cpanel);
}
public boolean action(Event event, Object arg){
if(event.target instanceof Button)
{
if(arg.equals("ページ1"))
layout.show(cpanel, "card 1");
else if(arg.equals("ページ2"))
layout.show(cpanel, "card 2");
else if(arg.equals("ページ3"))
layout.show(cpanel, "card 3");
return true;
}
return false;
}
}